示例#1
0
    def catch_api_proxy_jobs_get_all():

        resp = requests.get(
            f'http://{app.config["ORCHEST_API_ADDRESS"]}/api/jobs/' +
            request_args_to_string(request.args))

        return resp.content, resp.status_code, resp.headers.items()
示例#2
0
    def catch_api_proxy_job_pipeline_runs(job_uuid):

        resp = requests.get("http://" + app.config["ORCHEST_API_ADDRESS"] +
                            "/api/jobs/%s/pipeline_runs" % (job_uuid) +
                            request_args_to_string(request.args))

        return resp.content, resp.status_code, resp.headers.items()
示例#3
0
    def catch_api_proxy_sessions_get():

        resp = requests.get(
            "http://" + app.config["ORCHEST_API_ADDRESS"] + "/api/sessions/" +
            request_args_to_string(request.args), )

        return resp.content, resp.status_code, resp.headers.items()
示例#4
0
    def catch_api_proxy_runs():

        if request.method == "POST":

            json_obj = request.json

            # add image mapping
            # TODO: replace with dynamic mapping instead of hardcoded
            # All the paths are container path
            json_obj["run_config"] = {
                "userdir_pvc":
                app.config["USERDIR_PVC"],
                "project_dir":
                get_project_directory(json_obj["project_uuid"]),
                "pipeline_path":
                pipeline_uuid_to_path(json_obj["pipeline_definition"]["uuid"],
                                      json_obj["project_uuid"]),
                "pipeline_uuid":
                json_obj["pipeline_definition"]["uuid"],
                "project_uuid":
                json_obj["project_uuid"],
            }

            resp = requests.post(
                "http://" + app.config["ORCHEST_API_ADDRESS"] + "/api/runs/",
                json=json_obj,
            )

            analytics.send_event(
                app,
                analytics.Event.PIPELINE_RUN_START,
                {
                    "run_uuid": resp.json().get("uuid"),
                    "run_type": "interactive",
                    "pipeline_definition": json_obj["pipeline_definition"],
                    "step_uuids_to_execute": json_obj["uuids"],
                },
            )

            return resp.content, resp.status_code, resp.headers.items()

        elif request.method == "GET":

            resp = requests.get(
                "http://" + app.config["ORCHEST_API_ADDRESS"] + "/api/runs/" +
                request_args_to_string(request.args), )

            return resp.content, resp.status_code, resp.headers.items()
示例#5
0
    def catch_api_proxy_runs():

        if request.method == "POST":

            json_obj = request.json

            # add image mapping
            # TODO: replace with dynamic mapping instead of hardcoded
            json_obj["run_config"] = {
                "host_user_dir":
                app.config["HOST_USER_DIR"],
                "project_dir":
                get_project_directory(json_obj["project_uuid"],
                                      host_path=True),
                "pipeline_path":
                pipeline_uuid_to_path(json_obj["pipeline_definition"]["uuid"],
                                      json_obj["project_uuid"]),
            }

            resp = requests.post(
                "http://" + app.config["ORCHEST_API_ADDRESS"] + "/api/runs/",
                json=json_obj,
            )

            analytics.send_pipeline_run_start(
                app,
                f"{json_obj['project_uuid']}-{json_obj['pipeline_definition']['uuid']}",
                get_project_directory(json_obj["project_uuid"]),
                "interactive",
            )

            return resp.content, resp.status_code, resp.headers.items()

        elif request.method == "GET":

            resp = requests.get(
                "http://" + app.config["ORCHEST_API_ADDRESS"] + "/api/runs/" +
                request_args_to_string(request.args), )

            return resp.content, resp.status_code, resp.headers.items()