예제 #1
0
파일: start.py 프로젝트: DLR-RM/RAFCON
def setup_argument_parser():
    """Sets up teh parser with the required arguments

    :return: The parser object
    """
    default_config_path = filesystem.get_default_config_path()
    default_log_path = filesystem.get_default_log_path()

    filesystem.create_path(default_config_path)
    filesystem.create_path(default_log_path)

    parser = core_singletons.argument_parser
    parser.add_argument('-n', '--new', action='store_true', help=_("whether to create a new state-machine"))
    parser.add_argument('-o', '--open', action='store', nargs='*', type=parse_state_machine_path,
                        dest='state_machine_paths', metavar='path',
                        help=_("specify directories of state-machines that shall be opened. Paths must contain a "
                               "statemachine.json file"))
    parser.add_argument('-c', '--config', action='store', type=config_path, metavar='path', dest='config_path',
                        default=default_config_path, nargs='?', const=default_config_path,
                        help=_("path to the configuration file config.yaml. Use 'None' to prevent the generation of a "
                               "config file and use the default configuration. Default: {0}"
                               "").format(default_config_path))
    parser.add_argument('-g', '--gui_config', action='store', type=config_path, metavar='path', dest='gui_config_path',
                        default=default_config_path, nargs='?', const=default_config_path,
                        help=_("path to the configuration file gui_config.yaml. "
                               "Use 'None' to prevent the generation of a config file and use the default "
                               "configuration. Default: {0}").format(default_config_path))
    parser.add_argument('-d', '--design_config', action='store', type=config_path, metavar='path',
                        dest='design_config_path', default=None, nargs='?', const=default_config_path,
                        help=_("path to the configuration file design_config.yaml. "
                               "Use 'None' to prevent the generation of a config file and use the default "
                               "configuration. Default: {0}").format(default_config_path))
    parser.add_argument('-r', '--runtime_config', action='store', type=config_path, metavar='path', dest='runtime_config_path',
                        default=default_config_path, nargs='?', const=default_config_path,
                        help=_("path to the configuration file runtime_config.yaml. "
                               "Use 'None' to prevent the generation of a config file and use the default "
                               "configuration. Default: {0}").format(default_config_path))
    parser.add_argument('-ss', '--start_state_machine', dest='start_state_machine_flag', action='store_true',
                        help=_("a flag to specify if the first state machine of -o should be started after opening"))
    parser.add_argument('-s', '--start_state_path', metavar='path', dest='start_state_path', default=None, nargs='?',
                        help=_("path within a state machine to the state that should be launched which consists of "
                               "state ids e.g. QPOXGD/YVWJKZ where QPOXGD is the root state and YVWJKZ its child states"
                               " to start from"))
    parser.add_argument('-q', '--quit', dest='quit_flag', action='store_true',
                        help=_("a flag to specify if the gui should quit after launching a state machine"))
    parser.add_argument('-mp', '--memory-profiling', dest='memory_profiling', action='store_true',
                        help=_("a flag to specify if the gui should enable memory profiling"))
    parser.add_argument('-mpp', '--memory-profiling-path', action='store', type=config_path, metavar='path', dest='memory_profiling_path',
                        default=default_log_path, nargs='?', const=default_log_path,
                        help=_("path to the memory profiling log memoy_profiling.log").format(default_log_path))
    parser.add_argument('-mpi', '--memory-profiling-interval', dest='memory_profiling_interval', action='store', default=10,
                        help=_("The interval between snapshots creaton for memory profiling in seconds"))
    parser.add_argument('-mppr', '--memory-profiling-print', dest='memory_profiling_print', action='store_true',
                        help=_("a flag to specify if the memory profiling results should be printed"))

    return parser
예제 #2
0
def setup_argument_parser():
    """Sets up teh parser with the required arguments

    :return: The parser object
    """
    default_config_path = filesystem.get_default_config_path()
    default_log_path = filesystem.get_default_log_path()

    filesystem.create_path(default_config_path)
    filesystem.create_path(default_log_path)

    parser = core_singletons.argument_parser
    parser.add_argument(
        '-o',
        '--open',
        type=parse_state_machine_path,
        dest='state_machine_path',
        metavar='path',
        nargs='+',
        help="specify directories of state-machines that shall be opened. The path must "
        "contain a statemachine.json file")
    parser.add_argument(
        '-c',
        '--config',
        type=config_path,
        metavar='path',
        dest='config_path',
        default=default_config_path,
        nargs='?',
        const=default_config_path,
        help="path to the configuration file config.yaml. Use 'None' to prevent the generation of "
        "a config file and use the default configuration. Default: {0}".format(
            default_config_path))
    parser.add_argument('-r', '--remote', action='store_true', help="remote control mode")
    parser.add_argument(
        '-s',
        '--start_state_path',
        metavar='path',
        dest='start_state_path',
        default=None,
        nargs='?',
        help="path within a state machine to the state that should be launched. The state path "
        "consists of state ids (e.g. QPOXGD/YVWJKZ whereof QPOXGD is the root state and YVWJKZ "
        "it's child state to start from).")
    parser.add_argument('-mp', '--memory-profiling', dest='memory_profiling', action='store_true',
                        help=_("a flag to specify if the gui should enable memory profiling"))
    parser.add_argument('-mpp', '--memory-profiling-path', action='store', type=config_path, metavar='path', dest='memory_profiling_path',
                        default=default_log_path, nargs='?', const=default_log_path,
                        help=_("path to the memory profiling log memoy_profiling.log").format(default_log_path))
    parser.add_argument('-mpi', '--memory-profiling-interval', dest='memory_profiling_interval', action='store', default=10,
                        help=_("The interval between snapshots creaton for memory profiling in seconds"))
    parser.add_argument('-mppr', '--memory-profiling-print', dest='memory_profiling_print', action='store_true',
                        help=_("a flag to specify if the memory profiling results should be printed"))
    return parser
예제 #3
0
def setup_argument_parser():
    """Sets up teh parser with the required arguments

    :return: The parser object
    """
    default_config_path = filesystem.get_default_config_path()
    filesystem.create_path(default_config_path)

    parser = core_singletons.argument_parser
    parser.add_argument(
        '-o',
        '--open',
        type=parse_state_machine_path,
        dest='state_machine_path',
        metavar='path',
        nargs='+',
        help=
        "specify directories of state-machines that shall be opened. The path must "
        "contain a statemachine.json file")
    parser.add_argument(
        '-c',
        '--config',
        type=config_path,
        metavar='path',
        dest='config_path',
        default=default_config_path,
        nargs='?',
        const=default_config_path,
        help=
        "path to the configuration file config.yaml. Use 'None' to prevent the generation of "
        "a config file and use the default configuration. Default: {0}".format(
            default_config_path))
    parser.add_argument('-r',
                        '--remote',
                        action='store_true',
                        help="remote control mode")
    parser.add_argument(
        '-s',
        '--start_state_path',
        metavar='path',
        dest='start_state_path',
        default=None,
        nargs='?',
        help=
        "path within a state machine to the state that should be launched. The state path "
        "consists of state ids (e.g. QPOXGD/YVWJKZ whereof QPOXGD is the root state and YVWJKZ "
        "it's child state to start from).")
    return parser