Example #1
0
def execute_command():
    """ Runs the deploy command """

    parser = ArgumentParser()

    parser.description = cli.reformat(DESCRIPTION)

    parser.add_argument(
        'deploy',
        type=str,
        help='The deploy command to execute'
    )

    parser.add_argument(
        'root_path',
        type=str,
        help=cli.reformat("""
            The folder in the S3 bucket where your files will be uploaded
            """)
    )

    parser.add_argument(
        '-p', '--profile',
        dest='profile',
        type=str,
        default=None,
        help=cli.reformat("""
            The name of the AWS credentials profile to use for access to the
            AWS S3 bucket resources
            """)
    )

    parser.add_argument(
        '-b', '--bucket',
        dest='bucket',
        type=str,
        default=None,
        help=cli.reformat("""
            The name of the S3 bucket where the files will be uploaded
            """)
    )

    args = vars(parser.parse_args())
    configs = system.load_configs()

    upload_in_folder(
        get_aws_settings(configs, **args),
        paths.results('report')
    )
    system.log('[COMPLETE]: Trials have been deployed')
Example #2
0
def execute_command():
    """

    :return:
    """

    parser = ArgumentParser()

    parser.description = cli.reformat(DESCRIPTION)

    parser.add_argument("list_command", type=str, help="The list command itself")

    parser.add_argument("report_type", type=str, nargs="?", default=None, help="The type of report to list.")

    args = vars(parser.parse_args())

    report_type = args["report_type"]
    if not report_type:
        report_type = "all"
    else:
        report_type = report_type.lower()

    print("")
    if report_type[0] == "g":
        list_groups()
    elif report_type[0] == "t":
        list_trials()
    else:
        list_groups()
        print("")
        list_trials()
def list_modules():

    for key in dir(ME):
        item = getattr(ME, key)
        if hasattr(item, 'DESCRIPTION'):
            print('')
            system.log('[{}]:\n   {}'.format(
                key.strip('_'),
                cli.reformat(getattr(item, 'DESCRIPTION'))
                    .replace('\n', '\n   ')
            ))
def execute_command():

    path = '/usr/local/bin/tracksim'
    if not os.path.exists(path):
        system.log(cli.reformat("""
            [INFO]: The tracksim command was not registered. Operation aborted.
            """))
        return

    os.remove(path)

    system.log("""
        [SUCCESS]: The tracksim command is no longer registered for global use.
        """)
def execute_command():
    """

    :return:
    """

    parser = ArgumentParser()

    parser.description = cli.reformat(DESCRIPTION)

    parser.add_argument(
        'generate_command',
        type=str,
        help='The generate command itself'
    )

    parser.add_argument(
        'trial_or_group',
        type=str,
        help='Path to a trial or group file where the data source is specified'
    )

    parser.add_argument(
        'output_filename',
        type=str,
        help='Name of the csv file to be created'
    )

    args = parser.parse_args()
    cli_configs = system.load_configs()

    path = get_path(args.trial_or_group, cli_configs)
    if path is None:
        system.log('ERROR: Invalid or missing trial/group path')
        sys.exit(1)

    settings = configs.load(None, path)
    out_path = os.path.join(settings['directory'], args.output_filename)

    simulate.load_trackway_positions(
        settings,
        save_as=out_path
    )
Example #6
0
def execute_command():

    parser = ArgumentParser(description=DESCRIPTION)

    parser.add_argument("create_command", help="The create command itself")

    parser.add_argument(
        "-t",
        "--trackway",
        dest="trackway_name",
        type=str,
        default=None,
        help=cli.reformat(
            """
            The name of the trackway for the simulation
            """
        ),
    )

    parser.add_argument(
        "-s",
        "--scenario",
        dest="scenario_name",
        type=str,
        default=None,
        help=cli.reformat(
            """
            The name of the simulation scenario
            """
        ),
    )

    parser.add_argument(
        "-d",
        "--data",
        dest="data_filename",
        type=str,
        default=None,
        help=cli.reformat(
            """
            The name of the csv file
            """
        ),
    )

    parser.add_argument(
        "-p",
        "--path",
        dest="root_path",
        type=str,
        default=".",
        help=cli.reformat(
            """
            The path to the root directory where this simulation will be
            created
            """
        ),
    )

    parser.add_argument(
        "-c",
        "--cycle",
        dest="duty_cycle",
        type=float,
        default=0.6,
        help=cli.reformat(
            """
            The path to the root directory where this simulation will be
            created
            """
        ),
    )

    parser.add_argument(
        "-f",
        "--frequency",
        dest="steps_per_cycle",
        type=int,
        default=20,
        help=cli.reformat(
            """
            The path to the root directory where this simulation will be
            created
            """
        ),
    )

    parser.add_argument(
        "-b",
        "--begin-cycle",
        dest="begin_cycle",
        type=float,
        default=None,
        help="The cycle at which to start the simulation",
    )

    parser.add_argument(
        "-e", "--end-cycle", dest="end_cycle", type=float, default=None, help="The cycle at which to end the simulation"
    )

    kwargs = vars(parser.parse_args())
    scenario.create(**kwargs)
Example #7
0
def execute_command():
    """

    :return:
    """

    parser = ArgumentParser()

    parser.description = cli.reformat(DESCRIPTION)

    parser.add_argument(
        'run',
        type=str,
        help='The run command to execute'
    )

    parser.add_argument(
        'path',
        type=str,
        help=cli.reformat("""
            The relative or absolute path to either a group or trial simulation
            configuration file, or a directory path in which a group trial
            configuration file resides.
            """)
    )

    parser.add_argument(
        '-st', '--startTime',
        dest='start_time',
        type=float,
        default=-1,
        help=cli.reformat("""
            The time at which the simulation should start. The default value
            is 0.
            """)
    )

    parser.add_argument(
        '-et', '--endTime',
        dest='end_time',
        type=float,
        default=-1,
        help=cli.reformat("""
            The time at which the simulation should stop. The default value is
            to run until the end of the simulation.
            """)
    )

    parser.add_argument(
        '-d', '--directory',
        dest='results_path',
        type=str,
        default=None,
        help=cli.reformat("""
            An absolute path to the output directory where you would like the
            trial results stored. This overrides the output directory specified
            by the configure command or from within the trial or group
            configuration file.
            """)
    )

    parser.add_argument(
        '-a', '--all',
        dest='run_all_groups',
        action='store_true',
        default=False,
        help=cli.reformat("""
            When included, this flag indicates that all of the group files
            within the specified path directory should be run in order,
            instead of just the first one found, which is the default behavior.
            """)
    )

    run(**vars(parser.parse_args()))
Example #8
0
def execute_command():
    """

    :return:
    """

    parser = ArgumentParser()

    parser.description = cli.reformat(DESCRIPTION)

    parser.add_argument(
        'export',
        type=str,
        help='The export command to execute'
    )

    parser.add_argument(
        'path',
        type=str,
        help=cli.reformat("""
            The relative or absolute path to the location where the exported
            reports directory will be created
            """)
    )

    parser.add_argument(
        '-d', '--directory',
        dest='directory_name',
        type=str,
        default='reports',
        help=cli.reformat("""
            The name of the directory to be created to store the results
            """)
    )

    parser.add_argument(
        '-s', '--source',
        dest='source_directory',
        type=str,
        default=paths.results(),
        help=cli.reformat("""
            The source reports directory to be exported. This flag allows you
            to export results that are stored in locations other than the
            default report location
            """)
    )

    parser.add_argument(
        '-f', '--force',
        dest='force',
        action='store_true',
        default=False,
        help=cli.reformat("""
            When included, the export process will overwrite any existing data
            at the specified path and directory. It should only be used to
            replace an existing exported reports directory with newer data
            """)
    )

    parser.add_argument(
        '-od', '--omit-data',
        dest='omit_data',
        action='store_true',
        default=False,
        help=cli.reformat("""
            When included, the export process will skip all of the raw data
            files for each group and trial. These files are not necessary for
            viewing the reports. They exist for post-simulation analyses.
            """)
    )

    parser.add_argument(
        '-oh', '--omit-html',
        dest='omit_html',
        action='store_true',
        default=False,
        help=cli.reformat("""
            When included, the export process will skip all of the html viewing
            related files and only export the data files for each group and
            trial. This is useful if you want to share or store data for
            analysis.
            """)
    )

    run(**vars(parser.parse_args()))
def execute_command():
    """ Runs the configure command """

    parser = ArgumentParser()
    parser.description = cli.reformat(DESCRIPTION)

    parser.add_argument(
        'configure',
        type=str,
        help='The configure command to execute'
    )

    parser.add_argument(
        'key',
        type=str,
        nargs='?',
        default=None,
        help=cli.reformat("""
            The configuration key to be modify
            """)
    )

    parser.add_argument(
        'value',
        type=str,
        nargs='*',
        default=None,
        help=cli.reformat("""
            The value to assign to the configuration key. If omitted, the
            currently stored value for this key will be displayed.
            """)
    )

    parser.add_argument(
        '-r', '--remove',
        dest='remove',
        action='store_true',
        default=False,
        help=cli.reformat("""
            When included, this flag indicates that the specified key should
            be removed from the tracksim configs file.
            """)
    )

    parser.add_argument(
        '-l', '--list',
        dest='list',
        action='store_true',
        default=False,
        help=cli.reformat("""
            This flag is only useful when no key and no value have been
            specified. In such a case, this command will list all keys and
            values currently stored in the configuration file.
            """)
    )

    args = vars(parser.parse_args())

    configs = system.load_configs()
    if args['key'] is None:
        if args['list']:
            echo_all(configs)
        else:
            parser.print_help()
    elif len(args['value']) < 1:
        if args['remove']:
            remove_key(configs, args['key'])
        else:
            echo_key(configs, args['key'])
    else:
        set_key(configs, args['key'], args['value'])

    system.end(0)