示例#1
0
文件: list.py 项目: obilaniu/orion
def main(args):
    """List all experiments inside database."""
    config = experiment_builder.get_cmd_config(args)
    experiment_builder.setup_storage(config.get("storage"))

    query = {}

    if args["name"]:
        query["name"] = args["name"]

    experiments = get_storage().fetch_experiments(query)

    if args["name"]:
        root_experiments = experiments
    else:
        root_experiments = [
            exp for exp in experiments
            if exp["refers"].get("root_id", exp["_id"]) == exp["_id"]
        ]

    if not root_experiments:
        print("No experiment found")
        return

    for root_experiment in root_experiments:
        root = experiment_builder.load(
            name=root_experiment["name"],
            version=root_experiment.get("version")).node
        print_tree(root, nameattr="tree_name")
示例#2
0
def main(args):
    """List all experiments inside database."""
    builder = ExperimentBuilder()
    config = builder.fetch_full_config(args, use_db=False)
    builder.setup_database(config)

    query = {}

    if args['name']:
        query['name'] = args['name']

    experiments = Database().read("experiments", query)

    if args['name']:
        root_experiments = experiments
    else:
        root_experiments = [
            exp for exp in experiments
            if exp['refers'].get('root_id', exp['_id']) == exp['_id']
        ]

    for root_experiment in root_experiments:
        root = EVCBuilder().build_view_from({
            'name': root_experiment['name']
        }).node
        print_tree(root)
示例#3
0
def main(args):
    """List all experiments inside database."""
    config = experiment_builder.get_cmd_config(args)
    experiment_builder.setup_storage(config.get('storage'))

    query = {}

    if args['name']:
        query['name'] = args['name']

    experiments = get_storage().fetch_experiments(query)

    if args['name']:
        root_experiments = experiments
    else:
        root_experiments = [
            exp for exp in experiments
            if exp['refers'].get('root_id', exp['_id']) == exp['_id']
        ]

    if not root_experiments:
        print("No experiment found")
        return

    for root_experiment in root_experiments:
        root = experiment_builder.build_view(
            name=root_experiment['name'],
            version=root_experiment.get('version')).node
        print_tree(root, nameattr='tree_name')
示例#4
0
文件: set.py 项目: obilaniu/orion
def main(args):
    """Remove the experiment(s) or trial(s)."""
    config = experiment_builder.get_cmd_config(args)
    experiment_builder.setup_storage(config.get("storage"))

    # Find root experiment
    root = experiment_builder.load(
        name=args["name"], version=args.get("version", None)
    ).node

    try:
        query = build_query(args["query"])
        update = build_update(args["update"])
    except ValueError as e:
        print(f"Error: {e}", file=sys.stderr)
        return 1

    # List all experiments with children
    print_tree(root, nameattr="tree_name")

    confirmed = confirm_name(
        CONFIRM_MESSAGE.format(query=args["query"], update=args["update"]),
        args["name"],
        args["force"],
    )

    if not confirmed:
        print("Confirmation failed, aborting operation.")
        return 1

    storage = get_storage()

    process_updates(storage, root, query, update)

    return 0
示例#5
0
def main(args):
    """List all experiments inside database."""
    builder = ExperimentBuilder()
    config = builder.fetch_full_config(args, use_db=False)
    builder.setup_storage(config)

    query = {}

    if args['name']:
        query['name'] = args['name']

    experiments = get_storage().fetch_experiments(query)

    if args['name']:
        root_experiments = experiments
    else:
        root_experiments = [
            exp for exp in experiments
            if exp['refers'].get('root_id', exp['_id']) == exp['_id']
        ]

    for root_experiment in root_experiments:
        root = EVCBuilder().build_view_from({
            'name':
            root_experiment['name'],
            'version':
            root_experiment.get('version')
        }).node
        print_tree(root, nameattr='tree_name')
示例#6
0
def main(args):
    """Remove the experiment(s) or trial(s)."""
    config = experiment_builder.get_cmd_config(args)
    experiment_builder.setup_storage(config.get("storage"))

    # Find root experiment
    root = experiment_builder.load(name=args["name"],
                                   version=args.get("version", None)).node

    # List all experiments with children
    print_tree(root, nameattr="tree_name")

    storage = get_storage()

    release_locks(storage, root, args["name"], args["force"])