Beispiel #1
0
def get_option_parser():
    parser = COP(__doc__, jset=True, prep=True, icp=True)

    parser.add_option(
        "--strict",
        help="Fail any use of unsafe or experimental features. "
             "Currently this just means naked dummy tasks (tasks with no "
             "corresponding runtime section) as these may result from "
             "unintentional typographic errors in task names.",
        action="store_true", default=False, dest="strict")

    parser.add_option(
        "--output", "-o",
        help="Specify a file name to dump the processed flow.cylc.",
        metavar="FILENAME", action="store", dest="output")

    parser.add_option(
        "--profile", help="Output profiling (performance) information",
        action="store_true", default=False, dest="profile_mode")

    parser.add_option(
        "-u", "--run-mode", help="Validate for run mode.", action="store",
        default="live", dest="run_mode",
        choices=['live', 'dummy', 'dummy-local', 'simulation'])

    parser.set_defaults(is_validate=True)

    return parser
Beispiel #2
0
def get_option_parser():
    parser = COP(__doc__, jset=True, prep=True, icp=True)

    parser.add_option(
        "--check-circular",
        help="Check for circular dependencies in graphs when the number of "
             "tasks is greater than 100 (smaller graphs are always checked). "
             "This can be slow when the number of "
             "tasks is high.",
        action="store_true", default=False, dest="check_circular")

    parser.add_option(
        "--output", "-o",
        help="Specify a file name to dump the processed flow.cylc.",
        metavar="FILENAME", action="store", dest="output")

    parser.add_option(
        "--profile", help="Output profiling (performance) information",
        action="store_true", default=False, dest="profile_mode")

    parser.add_option(
        "-u", "--run-mode", help="Validate for run mode.", action="store",
        default="live", dest="run_mode",
        choices=['live', 'dummy', 'dummy-local', 'simulation'])

    parser.set_defaults(is_validate=True)

    return parser
Beispiel #3
0
def get_option_parser():
    parser = COP(__doc__,
                 jset=True,
                 icp=True,
                 argdoc=[("REG", "Suite name"),
                         ("TASK [...]",
                          "Family or task ID (%s)" % TaskID.SYNTAX)])
    parser.set_defaults(sched=False, dry_run=False)
    parser.add_option(
        "-d",
        "--dry-run",
        help="Generate the job script for the task, but don't submit it.",
        action="store_true",
        dest="dry_run")

    return parser
Beispiel #4
0
def get_option_parser(is_restart):
    """Parse CLI for "cylc run" or "cylc restart"."""
    if is_restart:
        parser = COP(RESTART_DOC, jset=True, argdoc=[SUITE_NAME_ARG_DOC])
    else:
        parser = COP(
            RUN_DOC,
            icp=True,
            jset=True,
            argdoc=[SUITE_NAME_ARG_DOC, START_POINT_ARG_DOC])

    parser.add_option(
        "-n", "--no-detach", "--non-daemon", help="Do not daemonize the suite",
        action="store_true", dest="no_detach")

    parser.add_option(
        "-a", "--no-auto-shutdown", help="Do not shut down"
        " the suite automatically when all tasks have finished."
        " This flag overrides the corresponding suite config item.",
        action="store_true", dest="no_auto_shutdown")

    parser.add_option(
        "--auto-shutdown", help="Shut down"
        " the suite automatically when all tasks have finished."
        " This flag overrides the corresponding suite config item.",
        action="store_false", dest="no_auto_shutdown")

    parser.add_option(
        "--profile", help="Output profiling (performance) information",
        action="store_true", dest="profile_mode")

    if is_restart:
        parser.add_option(
            "--checkpoint",
            help="Specify the ID of a checkpoint to restart from",
            metavar="CHECKPOINT-ID", action="store", dest="checkpoint")

        parser.add_option(
            "--ignore-initial-cycle-point",
            help=(
                "Ignore the initial cycle point in the suite run database. " +
                "If one is specified in the suite definition it will " +
                "be used, however."),
            action="store_true", dest="ignore_icp")

        parser.add_option(
            "--ignore-final-cycle-point",
            help=(
                "Ignore the final cycle point in the suite run database. " +
                "If one is specified in the suite definition it will " +
                "be used, however."),
            action="store_true", dest="ignore_fcp")

        parser.add_option(
            "--ignore-start-cycle-point",
            help="Ignore the start cycle point in the suite run database.",
            action="store_true", dest="ignore_startcp")

        parser.add_option(
            "--ignore-stop-cycle-point",
            help="Ignore the stop cycle point in the suite run database.",
            action="store_true", dest="ignore_stopcp")

        parser.set_defaults(icp=None, startcp=None, warm=None)
    else:
        parser.add_option(
            "-w", "--warm",
            help="Warm start the suite. The default is to cold start.",
            action="store_true", dest="warm")

        parser.add_option(
            "--start-cycle-point", "--start-point",
            help=(
                "Set the start cycle point. Implies --warm."
                "(Not to be confused with the initial cycle point.)"
            ),
            metavar="CYCLE_POINT", action="store", dest="startcp")

    parser.add_option(
        "--final-cycle-point", "--final-point", "--until", "--fcp",
        help="Set the final cycle point.",
        metavar="CYCLE_POINT", action="store", dest="fcp")

    parser.add_option(
        "--stop-cycle-point", "--stop-point",
        help=(
            "Set stop point. "
            "Shut down after all tasks have PASSED this cycle point. "
            "(Not to be confused with the final cycle point.)"
        ),
        metavar="CYCLE_POINT", action="store", dest="stopcp")

    parser.add_option(
        "--hold",
        help="Hold suite immediately on starting.",
        action="store_true", dest="hold_start")

    parser.add_option(
        "--hold-point", "--hold-after",
        help=(
            "Set hold cycle point. "
            "Hold suite AFTER all tasks have PASSED this cycle point."
        ),
        metavar="CYCLE_POINT", action="store", dest="holdcp")

    parser.add_option(
        "-m", "--mode",
        help="Run mode: live, dummy, dummy-local, simulation (default live).",
        metavar="STRING", action="store", dest="run_mode",
        choices=["live", "dummy", "dummy-local", "simulation"])

    parser.add_option(
        "--reference-log",
        help="Generate a reference log for use in reference tests.",
        action="store_true", default=False, dest="genref")

    parser.add_option(
        "--reference-test",
        help="Do a test run against a previously generated reference log.",
        action="store_true", default=False, dest="reftest")

    # Override standard parser option for specific help description.
    parser.add_option(
        "--host",
        help=(
            "Specify the host on which to start-up the suite. "
            "If not specified, a host will be selected using "
            "the 'suite servers' global config."
        ),
        metavar="HOST", action="store", dest="host")

    parser.set_defaults(stop_point_string=None)

    return parser
Beispiel #5
0
def get_option_parser(is_restart, add_std_opts=False):
    """Parse CLI for "cylc run" or "cylc restart"."""
    if is_restart:
        parser = COP(RESTART_DOC, jset=True, argdoc=[SUITE_NAME_ARG_DOC])
    else:
        parser = COP(RUN_DOC,
                     icp=True,
                     jset=True,
                     argdoc=[SUITE_NAME_ARG_DOC, START_POINT_ARG_DOC])

    parser.add_option(
        "-n",
        "--no-detach",
        "--non-daemon",
        help="Do not daemonize the suite (infers --format=plain)",
        action="store_true",
        dest="no_detach")

    parser.add_option(
        "-a",
        "--no-auto-shutdown",
        help="Do not shut down"
        " the suite automatically when all tasks have finished."
        " This flag overrides the corresponding suite config item.",
        action="store_true",
        dest="no_auto_shutdown")

    parser.add_option(
        "--auto-shutdown",
        help="Shut down"
        " the suite automatically when all tasks have finished."
        " This flag overrides the corresponding suite config item.",
        action="store_false",
        dest="no_auto_shutdown")

    parser.add_option("--profile",
                      help="Output profiling (performance) information",
                      action="store_true",
                      dest="profile_mode")

    if is_restart:
        parser.add_option(
            "--checkpoint",
            help="Specify the ID of a checkpoint to restart from",
            metavar="CHECKPOINT-ID",
            action="store",
            dest="checkpoint")

        parser.add_option(
            "--ignore-initial-cycle-point",
            help=(
                "Ignore the initial cycle point in the suite run database. " +
                "If one is specified in the suite definition it will " +
                "be used, however."),
            action="store_true",
            dest="ignore_icp")

        parser.add_option(
            "--ignore-final-cycle-point",
            help=("Ignore the final cycle point in the suite run database. " +
                  "If one is specified in the suite definition it will " +
                  "be used, however."),
            action="store_true",
            dest="ignore_fcp")

        parser.add_option(
            "--ignore-start-cycle-point",
            help="Ignore the start cycle point in the suite run database.",
            action="store_true",
            dest="ignore_startcp")

        parser.add_option(
            "--ignore-stop-cycle-point",
            help="Ignore the stop cycle point in the suite run database.",
            action="store_true",
            dest="ignore_stopcp")

        parser.set_defaults(icp=None,
                            startcp=None,
                            warm=None,
                            ignore_stopcp=None)
    else:
        parser.add_option(
            "-w",
            "--warm",
            help="Warm start the suite. The default is to cold start.",
            action="store_true",
            dest="warm")

        parser.add_option(
            "--start-cycle-point",
            "--start-point",
            help=("Set the start cycle point. Implies --warm."
                  "(Not to be confused with the initial cycle point.)"),
            metavar="CYCLE_POINT",
            action="store",
            dest="startcp")

    parser.add_option("--final-cycle-point",
                      "--final-point",
                      "--until",
                      "--fcp",
                      help="Set the final cycle point.",
                      metavar="CYCLE_POINT",
                      action="store",
                      dest="fcp")

    parser.add_option(
        "--stop-cycle-point",
        "--stop-point",
        help=("Set stop point. "
              "Shut down after all tasks have PASSED this cycle point. "
              "(Not to be confused with the final cycle point.)"
              "Adding this command line option over-rides the workflow"
              "config option [scheduling]stop after cycle point"),
        metavar="CYCLE_POINT",
        action="store",
        dest="stopcp")

    parser.add_option("--hold",
                      help="Hold suite immediately on starting.",
                      action="store_true",
                      dest="hold_start")

    parser.add_option(
        "--hold-point",
        "--hold-after",
        help=("Set hold cycle point. "
              "Hold suite AFTER all tasks have PASSED this cycle point."),
        metavar="CYCLE_POINT",
        action="store",
        dest="holdcp")

    parser.add_option(
        "-m",
        "--mode",
        help="Run mode: live, dummy, dummy-local, simulation (default live).",
        metavar="STRING",
        action="store",
        dest="run_mode",
        choices=["live", "dummy", "dummy-local", "simulation"])

    parser.add_option(
        "--reference-log",
        help="Generate a reference log for use in reference tests.",
        action="store_true",
        default=False,
        dest="genref")

    parser.add_option(
        "--reference-test",
        help="Do a test run against a previously generated reference log.",
        action="store_true",
        default=False,
        dest="reftest")

    # Override standard parser option for specific help description.
    parser.add_option("--host",
                      help=("Specify the host on which to start-up the suite. "
                            "If not specified, a host will be selected using "
                            "the 'suite servers' global config."),
                      metavar="HOST",
                      action="store",
                      dest="host")

    parser.add_option(
        "--format",
        help="The format of the output: 'plain'=human readable, 'json'",
        choices=("plain", "json"),
        default="plain")

    parser.add_option(
        "--main-loop",
        help=("Specify an additional plugin to run in the main loop."
              " These are used in combination with those specified in"
              " [cylc][main loop]plugins. Can be used multiple times"),
        metavar="PLUGIN_NAME",
        action="append",
        dest="main_loop")

    parser.add_option(
        "--abort-if-any-task-fails",
        help="If set workflow will abort with status 1 if any task fails.",
        action="store_true",
        default=False,
        dest="abort_if_any_task_fails")

    parser.set_defaults(stop_point_string=None)
    if add_std_opts:
        # This is for the API wrapper for integration tests. Otherwise (CLI
        # use) "standard options" are added later in options.parse_args().
        # They should really be added in options.__init__() but that requires a
        # bit of refactoring because option clashes are handled bass-ackwards
        # ("overrides" are added before standard options).
        parser.add_std_options()

    return parser