示例#1
0
def new_task():
    if request.method == "POST":
        try:
            data = request.json
            new_task = converter.structure(data, dacapo.configurables.Task)
            new_task.verify()
            db = get_db()
            db.add_task(new_task)
            return jsonify({"success": True})
        except Exception as e:
            raise (e)
            return jsonify({"success": False, "error": str(e)})

    fields = parse_fields(dacapo.configurables.Task)
    return render_template("dacapo/forms/task.html", fields=fields, id_prefix="task")
示例#2
0
def start_runs():
    if request.method == "POST":
        config_json = request.json
        run_execution = converter.structure(config_json,
                                            dacapo.configs.RunExecution)
        run_configs = [
            dacapo.configs.Run(
                name=run["name"],
                task=run["task"][0],
                dataset=run["dataset"][0],
                model=run["model"][0],
                optimizer=run["optimizer"][0],
                execution_details=run_execution,
                repetition=i,
            ) for run in config_json.pop("runs")
            for i in range(run_execution.repetitions)
        ]

        dacapo.run_all(run_configs, run_execution.num_workers)

    return jsonify({"success": True})