Skip to content

Fee Spec

fee_spec

fee_spec

Attributes

logger module-attribute

logger = getLogger(__name__)

Functions

main

main(args)

Main entry point allowing external calls Entry point for console_scripts Args: args ([str]): command line parameter list

Source code in scripts/cctbx/fee_spec.py
def main(args):
    """
    Main entry point allowing external calls
    Entry point for console_scripts
    Args:
      args ([str]): command line parameter list
    """
    args = parse_args(args)
    exp = args.experiment
    facility = args.facility
    exp_run_list = args.runs

    if len(exp_run_list) > 1:
        runs = " ".join(exp_run_list)
    else:
        runs = exp_run_list[0]
    print(runs)
    output(exp, runs, facility)

output

output(exp: str = None, runs: str = None, facility: str = 'S3DF')

Don't use this in hutch python.

Parameters:

exp (str): 
    experiment number. Current experiment by default

run_list (list): 
    List of run numbers. Last run number by default

facility (str): Default: "S3DF". Options: "S3DF, NERSC".
Source code in scripts/cctbx/fee_spec.py
def output(
        exp: str = None,
        runs: str =None,
        facility: str = "S3DF"):
    """Don't use this in hutch python.

    Parameters:

        exp (str): 
            experiment number. Current experiment by default

        run_list (list): 
            List of run numbers. Last run number by default

        facility (str): Default: "S3DF". Options: "S3DF, NERSC".
    """
    if facility == "NERSC":
        exp = exp[3:-2]
        proc = [
                f"ssh -i ~/.ssh/cctbx -YAC cctbx@perlmutter-p1.nersc.gov "
                f"/global/common/software/lcls/mfx/scripts/cctbx/fee_spec.sh "
                f"{facility} {runs}"
            ]
    elif facility == "S3DF":
        proc = [
                f"ssh -YAC psana "
                f"/sdf/group/lcls/ds/tools/mfx/scripts/cctbx/fee_spec.sh "
                f"{facility} {runs}"
            ]
    else:
        logging.warning(f"Facility not found: {facility}")

    logging.info(proc)
    os.system(proc[0])

parse_args

parse_args(args)

Parse command line parameters

Args: args ([str]): command line parameters as list of strings

Returns: :obj:argparse.Namespace: command line parameters namespace

Source code in scripts/cctbx/fee_spec.py
def parse_args(args):
    """Parse command line parameters

    Args:
      args ([str]): command line parameters as list of strings

    Returns:
      :obj:`argparse.Namespace`: command line parameters namespace
    """
    parser = argparse.ArgumentParser(
        description="startup script for cctbx on iana."
    )
    parser.add_argument(
        "--experiment",
        "-e",
        dest="experiment",
        default=None,
        help="Enter -e to specify experiment number",
    )
    parser.add_argument(
        "--facility",
        "-f",
        dest="facility",
        default=None,
        help="Enter -f to specify facility",
    )
    parser.add_argument(
        "--runs",
        "-r",
        dest="runs",
        nargs='+',
        default=None,
        help="Enter -r for List of run numbers. Last run number by default"
    )

    return parser.parse_args(args)

run

run()

Entry point for console_scripts

Source code in scripts/cctbx/fee_spec.py
def run():
    """Entry point for console_scripts"""
    main(sys.argv[1:])