Beispiel #1
0
def set_name(args: Namespace) -> None:
    session = setup_session(args)
    exp = bindings.get_GetExperiment(
        session, experimentId=args.experiment_id).experiment
    exp_patch = bindings.v1PatchExperiment.from_json(exp.to_json())
    exp_patch.name = args.name
    bindings.patch_PatchExperiment(session,
                                   body=exp_patch,
                                   experiment_id=args.experiment_id)
    print("Set name of experiment {} to '{}'".format(args.experiment_id,
                                                     args.name))
Beispiel #2
0
def remove_label(args: Namespace) -> None:
    session = setup_session(args)
    exp = bindings.get_GetExperiment(
        session, experimentId=args.experiment_id).experiment
    exp_patch = bindings.v1PatchExperiment.from_json(exp.to_json())
    if (exp_patch.labels) and (args.label in exp_patch.labels):
        exp_patch.labels = [
            label for label in exp_patch.labels if label != args.label
        ]
        bindings.patch_PatchExperiment(session,
                                       body=exp_patch,
                                       experiment_id=args.experiment_id)
    print("Removed label '{}' from experiment {}".format(
        args.label, args.experiment_id))
Beispiel #3
0
def add_label(args: Namespace) -> None:
    session = setup_session(args)
    exp = bindings.get_GetExperiment(
        session, experimentId=args.experiment_id).experiment
    exp_patch = bindings.v1PatchExperiment.from_json(exp.to_json())
    if exp_patch.labels is None:
        exp_patch.labels = []
    if args.label not in exp_patch.labels:
        exp_patch.labels = list(exp_patch.labels) + [args.label]
        bindings.patch_PatchExperiment(session,
                                       body=exp_patch,
                                       experiment_id=args.experiment_id)
    print("Added label '{}' to experiment {}".format(args.label,
                                                     args.experiment_id))