def save_experiment(name, table_name, clusters, duree, mem, env, gpu):

    already_existing = load_experiments(filter_eq_dct=dict(name=name))

    if len(already_existing) > 0:
        experiment = already_existing[0]
        update_dict = dict([(key, value)
                            for key, value in locals().iteritems()
                            if key in experiment])
        update_dict["clusters"] = _validate_clusters_for_saving(
            clusters, experiment)
        database.update("experiments", [experiment], update_dict)
    else:
        experiment = dict(
            name=name,
            table=table_name,
            duree=duree,
            mem=mem,
            env=env,
            gpu=gpu)

        experiment["clusters"] = _validate_clusters_for_saving(
            clusters, experiment)

        experiment = database.save("experiments", experiment)

    return experiment
Beispiel #2
0
def save_job(table_name, job_desc):

    job = database.save(table_name, job_desc)

    return job