def tearDown(self): MINIO_CLIENT.remove_object( bucket_name=BUCKET_NAME, object_name=f"datasets/{DATASET}/runs/{RUN_ID}/operators/{OPERATOR_ID}/{DATASET}/{DATASET}.metadata", ) MINIO_CLIENT.remove_object( bucket_name=BUCKET_NAME, object_name=f"datasets/{DATASET}/runs/{RUN_ID}/operators/{OPERATOR_ID}/{DATASET}/{DATASET}", ) MINIO_CLIENT.remove_object( bucket_name=BUCKET_NAME, object_name=f"datasets/{DATASET}/{DATASET}.metadata", ) MINIO_CLIENT.remove_object( bucket_name=BUCKET_NAME, object_name=f"datasets/{DATASET}/{DATASET}", ) conn = engine.connect() text = f"DELETE FROM operators WHERE experiment_id = '{EXPERIMENT_ID}'" conn.execute(text) text = f"DELETE FROM components WHERE uuid = '{COMPONENT_ID}'" conn.execute(text) text = f"DELETE FROM experiments WHERE project_id = '{PROJECT_ID}'" conn.execute(text) text = f"DELETE FROM projects WHERE uuid = '{PROJECT_ID}'" conn.execute(text) conn.close()
def tearDown(self): conn = engine.connect() text = f"DELETE FROM templates WHERE uuid = '{TEMPLATE_ID}'" conn.execute(text) text = f"DELETE FROM dependencies WHERE operator_id in" \ f" (SELECT uuid FROM operators WHERE task_id = '{TASK_ID}')" conn.execute(text) text = f"DELETE FROM operators WHERE experiment_id = '{EXPERIMENT_ID}'" conn.execute(text) text = f"DELETE FROM operators WHERE experiment_id =" \ f" (SELECT uuid FROM experiments where name = '{NAME_COPYFROM}')" conn.execute(text) text = f"DELETE FROM experiments WHERE project_id in ('{PROJECT_ID}')" conn.execute(text) text = f"DELETE FROM projects WHERE uuid = '{PROJECT_ID}'" conn.execute(text) text = f"DELETE FROM tasks WHERE uuid = '{TASK_ID}'" conn.execute(text) conn.close()
def tearDown(self): prefix = f"tasks/{NAME}" for obj in MINIO_CLIENT.list_objects(BUCKET_NAME, prefix=prefix, recursive=True): MINIO_CLIENT.remove_object(BUCKET_NAME, obj.object_name) session = requests.Session() session.cookies.update(COOKIES) session.headers.update(HEADERS) session.hooks = { "response": lambda r, *args, **kwargs: r.raise_for_status(), } r = session.get(url=f"{JUPYTER_ENDPOINT}/api/contents/tasks", ) contents = r.json()["content"] for content in contents: session.delete( url= f"{JUPYTER_ENDPOINT}/api/contents/{content['path']}/Experiment.ipynb", ) session.delete( url= f"{JUPYTER_ENDPOINT}/api/contents/{content['path']}/Deployment.ipynb", ) session.delete( url=f"{JUPYTER_ENDPOINT}/api/contents/{content['path']}", ) conn = engine.connect() text = f"DELETE FROM tasks WHERE 1 = 1" conn.execute(text) conn.close()
def setUp(self): self.maxDiff = None conn = engine.connect() text = ( f"INSERT INTO tasks (uuid, name, description, image, commands, arguments, tags, experiment_notebook_path, deployment_notebook_path, is_default, created_at, updated_at) " f"VALUES ('{TASK_ID}', '{NAME}', '{DESCRIPTION}', '{IMAGE}', '{COMMANDS_JSON}', '{ARGUMENTS_JSON}', '{TAGS_JSON}', '{EXPERIMENT_NOTEBOOK_PATH}', '{DEPLOYMENT_NOTEBOOK_PATH}', 0, '{CREATED_AT}', '{UPDATED_AT}')" ) conn.execute(text) conn.close() try: MINIO_CLIENT.make_bucket(BUCKET_NAME) except BucketAlreadyOwnedByYou: pass file = BytesIO( b'{"cells":[{"cell_type":"code","execution_count":null,"metadata":{},"outputs":[],"source":[]}],"metadata":{"kernelspec":{"display_name":"Python 3","language":"python","name":"python3"},"language_info":{"codemirror_mode":{"name":"ipython","version":3},"file_extension":".py","mimetype":"text/x-python","name":"python","nbconvert_exporter":"python","pygments_lexer":"ipython3","version":"3.6.9"}},"nbformat":4,"nbformat_minor":4}' ) MINIO_CLIENT.put_object( bucket_name=BUCKET_NAME, object_name=EXPERIMENT_NOTEBOOK_PATH[len(f"minio://{BUCKET_NAME}/" ):], data=file, length=file.getbuffer().nbytes, )
def tearDown(self): conn = engine.connect() text = f"DELETE FROM templates WHERE uuid = '{TEMPLATE_ID}'" conn.execute(text) text = f"DELETE FROM operators WHERE experiment_id in" \ f"(SELECT uuid FROM experiments where project_id = '{PROJECT_ID}')" conn.execute(text) text = f"DELETE FROM operators WHERE deployment_id in" \ f"(SELECT uuid FROM deployments where project_id = '{PROJECT_ID}')" conn.execute(text) text = f"DELETE FROM tasks WHERE uuid IN ('{TASK_ID}', '{TASK_DATASET_ID}, {TASK_ID_2}')" conn.execute(text) text = f"DELETE FROM deployments WHERE project_id = '{PROJECT_ID}'" conn.execute(text) text = f"DELETE FROM deployments WHERE name = '{DEPLOYMENT_MOCK_NAME}'" conn.execute(text) text = f"DELETE FROM experiments WHERE project_id = '{PROJECT_ID}'" conn.execute(text) text = f"DELETE FROM projects WHERE uuid = '{PROJECT_ID}'" conn.execute(text) conn.close()
def setUp(self): self.maxDiff = None conn = engine.connect() text = ( f"INSERT INTO tasks (uuid, name, description, image, commands, arguments, tags, experiment_notebook_path, deployment_notebook_path, is_default, created_at, updated_at) " f"VALUES ('{TASK_ID}', '{NAME}', '{DESCRIPTION}', '{IMAGE}', '{COMMANDS_JSON}', '{ARGUMENTS_JSON}', '{TAGS_JSON}', '{EXPERIMENT_NOTEBOOK_PATH}', '{DEPLOYMENT_NOTEBOOK_PATH}', 0, '{CREATED_AT}', '{UPDATED_AT}')" ) conn.execute(text) text = ( f"INSERT INTO projects (uuid, name, created_at, updated_at) " f"VALUES ('{PROJECT_ID}', '{NAME}', '{CREATED_AT}', '{UPDATED_AT}')" ) conn.execute(text) text = ( f"INSERT INTO experiments (uuid, name, project_id, position, is_active, created_at, updated_at) VALUES " f"('{EXPERIMENT_ID}', '{NAME}', '{PROJECT_ID}', '{POSITION}', 1, '{CREATED_AT}', '{UPDATED_AT}')" ) conn.execute(text) text = ( f"INSERT INTO operators (uuid, experiment_id, task_id, parameters, created_at, updated_at) " f"VALUES ('{OPERATOR_ID}', '{EXPERIMENT_ID}', '{TASK_ID}', '{PARAMETERS_JSON}', '{CREATED_AT}', '{UPDATED_AT}')" ) conn.execute(text) text = f"INSERT INTO templates (uuid, name, tasks, created_at, updated_at) VALUES ('{TEMPLATE_ID}', '{NAME}', '{TASKS_JSON}', '{CREATED_AT}', '{UPDATED_AT}')" conn.execute(text) conn.close()
def setUp(self): self.maxDiff = None conn = engine.connect() text = ( f"INSERT INTO components (uuid, name, description, tags, training_notebook_path, inference_notebook_path, is_default, created_at, updated_at) " f"VALUES ('{COMPONENT_ID}', '{NAME}', '{DESCRIPTION}', '{TAGS_JSON}', '{TRAINING_NOTEBOOK_PATH}', '{INFERENCE_NOTEBOOK_PATH}', 0, '{CREATED_AT}', '{UPDATED_AT}')" ) conn.execute(text) text = ( f"INSERT INTO projects (uuid, name, created_at, updated_at) " f"VALUES ('{PROJECT_ID}', '{NAME}', '{CREATED_AT}', '{UPDATED_AT}')" ) conn.execute(text) text = ( f"INSERT INTO experiments (uuid, name, project_id, dataset, target, position, is_active, created_at, updated_at) " f"VALUES ('{EXPERIMENT_ID}', '{NAME}', '{PROJECT_ID}', '{DATASET}', '{TARGET}', '{POSITION}', 1, '{CREATED_AT}', '{UPDATED_AT}')" ) conn.execute(text) text = ( f"INSERT INTO operators (uuid, experiment_id, component_id, position, parameters, created_at, updated_at) " f"VALUES ('{OPERATOR_ID}', '{EXPERIMENT_ID}', '{COMPONENT_ID}', '{POSITION}', '{PARAMETERS_JSON}', '{CREATED_AT}', '{UPDATED_AT}')" ) conn.execute(text) text = ( f"INSERT INTO templates (uuid, name, components, created_at, updated_at) " f"VALUES ('{TEMPLATE_ID}', '{NAME}', '{COMPONENTS_JSON}', '{CREATED_AT}', '{UPDATED_AT}')" ) conn.execute(text) conn.close()
def tearDown(self): conn = engine.connect() text = f"DELETE FROM experiments WHERE uuid = '{EXPERIMENT_ID}'" conn.execute(text) text = f"DELETE FROM projects WHERE uuid = '{PROJECT_ID}'" conn.execute(text) conn.close()
def tearDown(self): prefix = f"components/{COMPONENT_ID}" for obj in MINIO_CLIENT.list_objects(BUCKET_NAME, prefix=prefix, recursive=True): MINIO_CLIENT.remove_object(BUCKET_NAME, obj.object_name) conn = engine.connect() text = f"DELETE FROM components WHERE 1 = 1" conn.execute(text) conn.close()
def setUp(self): self.maxDiff = None conn = engine.connect() text = ( f"INSERT INTO projects (uuid, name, created_at, updated_at) " f"VALUES ('{PROJECT_ID}', '{NAME}', '{CREATED_AT}', '{UPDATED_AT}')" ) conn.execute(text) text = ( f"INSERT INTO experiments (uuid, name, project_id, position, is_active, created_at, updated_at) " f"VALUES ('{EXPERIMENT_ID}', '{NAME}', '{PROJECT_ID}', '{POSITION}', 1, '{CREATED_AT}', '{UPDATED_AT}')" ) conn.execute(text) text = ( f"INSERT INTO components (uuid, name, description, commands, tags, experiment_notebook_path, deployment_notebook_path, created_at, updated_at) " f"VALUES ('{COMPONENT_ID}', '{NAME}', '{DESCRIPTION}', '{COMMANDS_JSON}', '{TAGS_JSON}', '{EXPERIMENT_NOTEBOOK_PATH}', '{DEPLOYMENT_NOTEBOOK_PATH}', '{CREATED_AT}', '{UPDATED_AT}')" ) conn.execute(text) text = ( f"INSERT INTO operators (uuid, experiment_id, component_id, parameters, created_at, updated_at) " f"VALUES ('{OPERATOR_ID}', '{EXPERIMENT_ID}', '{COMPONENT_ID}', '{PARAMETERS_JSON}', '{CREATED_AT}', '{UPDATED_AT}')" ) conn.execute(text) text = ( f"INSERT INTO operators (uuid, experiment_id, component_id, parameters, created_at, updated_at) " f"VALUES ('{OPERATOR_ID_2}', '{EXPERIMENT_ID}', '{COMPONENT_ID}', '{PARAMETERS_JSON}', '{CREATED_AT}', '{UPDATED_AT}')" ) conn.execute(text) text = ( f"INSERT INTO operators (uuid, experiment_id, component_id, parameters, created_at, updated_at) " f"VALUES ('{OPERATOR_ID_3}', '{EXPERIMENT_ID}', '{COMPONENT_ID}', '{PARAMETERS_JSON}', '{CREATED_AT}', '{UPDATED_AT}')" ) conn.execute(text) text = ( f"INSERT INTO operators (uuid, experiment_id, component_id, parameters, created_at, updated_at) " f"VALUES ('{OPERATOR_ID_4}', '{EXPERIMENT_ID}', '{COMPONENT_ID}', '{PARAMETERS_JSON}', '{CREATED_AT}', '{UPDATED_AT}')" ) conn.execute(text) text = ( f"INSERT INTO dependencies (uuid, operator_id, dependency) " f"VALUES ('{DEPENDENCY_ID}', '{OPERATOR_ID}', '{OPERATOR_ID_2}')") conn.execute(text) text = ( f"INSERT INTO dependencies (uuid, operator_id, dependency) " f"VALUES ('{DEPENDENCY_ID_2}', '{OPERATOR_ID_4}', '{OPERATOR_ID}')" ) conn.execute(text) conn.close()
def tearDown(self): conn = engine.connect() text = f"DELETE FROM tasks WHERE uuid = '{TASK_ID}'" conn.execute(text) conn.close() prefix = f"tasks/{TASK_ID}" for obj in MINIO_CLIENT.list_objects(BUCKET_NAME, prefix=prefix, recursive=True): MINIO_CLIENT.remove_object(BUCKET_NAME, obj.object_name)
def tearDown(self): self.proc.terminate() conn = engine.connect() text = f"DELETE FROM deployments WHERE project_id = '{PROJECT_ID}'" conn.execute(text) text = f"DELETE FROM projects WHERE uuid = '{PROJECT_ID}'" conn.execute(text) conn.close()
def tearDownClass(cls): conn = engine.connect() text = f"DELETE FROM deployments WHERE project_id = '{PROJECT_ID}'" conn.execute(text) text = f"DELETE FROM experiments WHERE project_id = '{PROJECT_ID}'" conn.execute(text) text = f"DELETE FROM projects WHERE uuid = '{PROJECT_ID}'" conn.execute(text) conn.close()
def tearDown(self): conn = engine.connect() text = f"DELETE FROM comparisons WHERE project_id in ('{PROJECT_ID}')" conn.execute(text) text = f"DELETE FROM experiments WHERE project_id in ('{PROJECT_ID}')" conn.execute(text) text = f"DELETE FROM projects WHERE uuid = '{PROJECT_ID}'" conn.execute(text) conn.close()
def tearDown(self): session = requests.Session() session.cookies.update(COOKIES) session.headers.update(HEADERS) session.hooks = { "response": lambda r, *args, **kwargs: r.raise_for_status(), } session.delete( url= f"{JUPYTER_ENDPOINT}/api/contents/experiments/{EXPERIMENT_ID}/operators/{OPERATOR_ID}/Experiment.ipynb", ) session.delete( url= f"{JUPYTER_ENDPOINT}/api/contents/experiments/{EXPERIMENT_ID}/operators/{OPERATOR_ID_2}/Experiment.ipynb", ) session.delete( url= f"{JUPYTER_ENDPOINT}/api/contents/experiments/{EXPERIMENT_ID}/operators/{OPERATOR_ID}", ) session.delete( url= f"{JUPYTER_ENDPOINT}/api/contents/experiments/{EXPERIMENT_ID}/operators/{OPERATOR_ID_2}", ) session.delete( url= f"{JUPYTER_ENDPOINT}/api/contents/experiments/{EXPERIMENT_ID}/operators", ) session.delete( url=f"{JUPYTER_ENDPOINT}/api/contents/experiments/{EXPERIMENT_ID}", ) conn = engine.connect() text = f"DELETE FROM operators WHERE uuid = '{OPERATOR_ID}'" conn.execute(text) text = f"DELETE FROM operators WHERE uuid = '{OPERATOR_ID_2}'" conn.execute(text) text = f"DELETE FROM experiments WHERE uuid = '{EXPERIMENT_ID}'" conn.execute(text) text = f"DELETE FROM tasks WHERE uuid = '{TASK_ID}'" conn.execute(text) text = f"DELETE FROM projects WHERE uuid = '{PROJECT_ID}'" conn.execute(text) conn.close()
def tearDown(self): conn = engine.connect() text = f"DELETE FROM operators WHERE experiment_id = '{EXPERIMENT_ID}'" conn.execute(text) text = f"DELETE FROM components WHERE uuid = '{COMPONENT_ID}'" conn.execute(text) text = f"DELETE FROM experiments WHERE project_id = '{PROJECT_ID}'" conn.execute(text) text = f"DELETE FROM projects WHERE uuid = '{PROJECT_ID}'" conn.execute(text) conn.close()
def tearDown(self): conn = engine.connect() text = f"DELETE FROM operators WHERE experiment_id in" \ f"(SELECT uuid FROM experiments where project_id = '{PROJECT_ID}')" conn.execute(text) text = f"DELETE FROM tasks WHERE uuid IN ('{TASK_ID}', '{TASK_DATASET_ID}')" conn.execute(text) text = f"DELETE FROM experiments WHERE project_id = '{PROJECT_ID}'" conn.execute(text) text = f"DELETE FROM projects WHERE uuid = '{PROJECT_ID}'" conn.execute(text) conn.close()
def setUp(self): self.maxDiff = None conn = engine.connect() text = ( f"INSERT INTO projects (uuid, name, created_at, updated_at, description) " f"VALUES ('{PROJECT_ID}', '{NAME}', '{CREATED_AT}', '{UPDATED_AT}', '{DESCRIPTION}')" ) conn.execute(text) text = ( f"INSERT INTO experiments (uuid, name, project_id, dataset, target, position, is_active, created_at, updated_at) " f"VALUES ('{EXPERIMENT_ID}', '{EXPERIMENT_NAME}', '{PROJECT_ID}', null, null, 0, 1, '{CREATED_AT}', '{UPDATED_AT}')" ) conn.execute(text) conn.close()
def tearDown(self): conn = engine.connect() text = f"DELETE FROM templates WHERE uuid = '{TEMPLATE_ID}'" conn.execute(text) text = f"DELETE FROM operators WHERE experiment_id = '{EXPERIMENT_ID}'" conn.execute(text) text = f"DELETE FROM experiments WHERE project_id = '{PROJECT_ID}'" conn.execute(text) text = f"DELETE FROM projects WHERE uuid = '{PROJECT_ID}'" conn.execute(text) text = f"DELETE FROM tasks WHERE uuid = '{TASK_ID}'" conn.execute(text) conn.close()
def tearDown(self): prefix = f"experiments/{EXPERIMENT_ID}" for obj in MINIO_CLIENT.list_objects(BUCKET_NAME, prefix=prefix, recursive=True): MINIO_CLIENT.remove_object(BUCKET_NAME, obj.object_name) conn = engine.connect() text = f"DELETE FROM operators WHERE experiment_id = '{EXPERIMENT_ID}'" conn.execute(text) text = f"DELETE FROM tasks WHERE uuid = '{TASK_ID}'" conn.execute(text) text = f"DELETE FROM experiments WHERE project_id = '{PROJECT_ID}'" conn.execute(text) text = f"DELETE FROM projects WHERE uuid = '{PROJECT_ID}'" conn.execute(text) conn.close()
def setUpClass(cls): cls.maxDiff = None conn = engine.connect() text = (f"INSERT INTO projects (uuid, name, created_at, updated_at) " f"VALUES (uuid, name, created_at, updated_at)") conn.execute(text, ( PROJECT_ID, NAME, CREATED_AT, UPDATED_AT, )) text = ( f"INSERT INTO experiments (uuid, name, project_id, position, is_active, created_at, updated_at) " f"VALUES (uuid, name, project_id, position, is_active, created_at, updated_at)" ) conn.execute(text, ( EXPERIMENT_ID, NAME, PROJECT_ID, POSITION, 1, CREATED_AT, UPDATED_AT, )) text = ( f"INSERT INTO deployments (uuid, name, project_id, experiment_id, position, is_active, created_at, updated_at) " f"VALUES (uuid, name, project_id, experiment_id, position, is_active, created_at, updated_at)" ) conn.execute(text, ( DEPLOYMENT_ID, NAME, PROJECT_ID, EXPERIMENT_ID, POSITION, 1, CREATED_AT, UPDATED_AT, )) conn.close()
def tearDown(self): conn = engine.connect() text = f"DELETE FROM monitorings WHERE deployment_id = '{DEPLOYMENT_ID}'" conn.execute(text) text = f"DELETE FROM deployments WHERE project_id = '{PROJECT_ID}'" conn.execute(text) text = f"DELETE FROM experiments WHERE project_id in ('{PROJECT_ID}')" conn.execute(text) text = f"DELETE FROM projects WHERE uuid = '{PROJECT_ID}'" conn.execute(text) text = f"DELETE FROM tasks WHERE uuid = '{TASK_ID}'" conn.execute(text) text = f"DELETE FROM tasks WHERE uuid = '{TASK_ID_2}'" conn.execute(text) conn.close()
def tearDown(self): conn = engine.connect() text = f"DELETE FROM operators WHERE experiment_id in" \ f"(SELECT uuid FROM experiments where project_id = '{PROJECT_ID}')" conn.execute(text) text = f"DELETE FROM deployments WHERE project_id = '{PROJECT_ID}'" conn.execute(text) text = f"DELETE FROM experiments WHERE project_id = '{PROJECT_ID}'" conn.execute(text) text = f"DELETE FROM projects WHERE uuid = '{PROJECT_ID}'" conn.execute(text) text = f"DELETE FROM tasks WHERE uuid IN ('{TASK_ID}', '{TASK_ID_2}')" conn.execute(text) conn.close() remove("tests/resources/mocked.yaml")
def setUp(self): self.maxDiff = None conn = engine.connect() text = ( f"INSERT INTO projects (uuid, name, description, created_at, updated_at) " f"VALUES (%s, %s, %s, %s, %s)" ) conn.execute(text, (PROJECT_ID, NAME, DESCRIPTION, CREATED_AT, UPDATED_AT,)) text = ( f"INSERT INTO projects (uuid, name, description, created_at, updated_at) " f"VALUES (%s, %s, %s, %s, %s)" ) conn.execute(text, (PROJECT_ID_2, NAME_2, DESCRIPTION, CREATED_AT, UPDATED_AT,)) text = ( f"INSERT INTO projects (uuid, name, description, created_at, updated_at) " f"VALUES (%s, %s, %s, %s, %s)" ) conn.execute(text, (PROJECT_ID_3, NAME_3, DESCRIPTION, CREATED_AT, UPDATED_AT,)) text = ( f"INSERT INTO experiments (uuid, name, project_id, position, is_active, created_at, updated_at) " f"VALUES (%s, %s, %s, %s, %s, %s, %s)" ) conn.execute(text, (EXPERIMENT_ID, EXPERIMENT_NAME, PROJECT_ID, 0, 1, CREATED_AT, UPDATED_AT,)) text = ( f"INSERT INTO experiments (uuid, name, project_id, position, is_active, created_at, updated_at) " f"VALUES (%s, %s, %s, %s, %s, %s, %s)" ) conn.execute(text, (EXPERIMENT_ID_2, EXPERIMENT_NAME, PROJECT_ID_3, 0, 1, CREATED_AT, UPDATED_AT,)) text = ( f"INSERT INTO deployments (uuid, name, project_id, experiment_id, position, is_active, created_at, updated_at) " f"VALUES (%s, %s, %s, %s, %s, %s, %s, %s)" ) conn.execute(text, (DEPLOYMENT_ID, NAME, PROJECT_ID_3, EXPERIMENT_ID_2, '0', 1, CREATED_AT, UPDATED_AT,)) conn.close()
def setUp(self): self.maxDiff = None conn = engine.connect() text = ( f"INSERT INTO projects (uuid, name, created_at, updated_at) " f"VALUES ('{PROJECT_ID}', '{NAME}', '{CREATED_AT}', '{UPDATED_AT}')" ) conn.execute(text) text = ( f"INSERT INTO experiments (uuid, name, project_id, position, is_active, created_at, updated_at) " f"VALUES ('{EXPERIMENT_ID}', '{NAME}', '{PROJECT_ID}', '{POSITION}', 1, '{CREATED_AT}', '{UPDATED_AT}')" ) conn.execute(text) text = ( f"INSERT INTO compare_result (uuid, project_id, created_at, updated_at) " f"VALUES ('{COMPARE_RESULT_ID}', '{PROJECT_ID}', '{CREATED_AT}', '{UPDATED_AT}')" ) conn.execute(text) conn.close()
def setUp(self): os.environ["BROKER_URL"] = "http://*****:*****@app.post("/") async def root(): return {} self.proc = multiprocessing.Process(target=uvicorn.run, args=(app, )) self.proc.start() conn = engine.connect() text = ( f"INSERT INTO projects (uuid, name, description, created_at, updated_at) " f"VALUES (%s, %s, %s, %s, %s)") conn.execute(text, ( PROJECT_ID, NAME, DESCRIPTION, CREATED_AT, UPDATED_AT, )) text = ( f"INSERT INTO deployments (uuid, name, project_id, experiment_id, position, is_active, created_at, updated_at) " f"VALUES (%s, %s, %s, %s, %s, %s, %s, %s)") conn.execute(text, ( DEPLOYMENT_ID, NAME, PROJECT_ID, EXPERIMENT_ID, POSITION, 1, CREATED_AT, UPDATED_AT, )) conn.close()
def setUp(self): self.maxDiff = None conn = engine.connect() text = ( f"INSERT INTO projects (uuid, name, created_at, updated_at) " f"VALUES (%s, %s, %s, %s)" ) conn.execute(text, (PROJECT_ID, NAME, CREATED_AT, UPDATED_AT,)) text = ( f"INSERT INTO experiments (uuid, name, project_id, position, is_active, created_at, updated_at) " f"VALUES (%s, %s, %s, %s, %s, %s, %s)" ) conn.execute(text, (EXPERIMENT_ID, NAME, PROJECT_ID, POSITION, 1, CREATED_AT, UPDATED_AT,)) text = ( f"INSERT INTO tasks (uuid, name, description, image, commands, arguments, tags, parameters, experiment_notebook_path, deployment_notebook_path, is_default, created_at, updated_at) " f"VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)" ) conn.execute(text, (TASK_ID, NAME, DESCRIPTION, IMAGE, COMMANDS_JSON, ARGUMENTS_JSON, TAGS_JSON, dumps([]), EXPERIMENT_NOTEBOOK_PATH, DEPLOYMENT_NOTEBOOK_PATH, 0, CREATED_AT, UPDATED_AT,)) text = ( f"INSERT INTO operators (uuid, experiment_id, task_id, parameters, created_at, updated_at) " f"VALUES (%s, %s, %s, %s, %s, %s)" ) conn.execute(text, (OPERATOR_ID, EXPERIMENT_ID, TASK_ID, PARAMETERS_JSON, CREATED_AT, UPDATED_AT,)) conn.close() t = np.arange(0.0, 2.0, 0.01) s = 1 + np.sin(2 * np.pi * t) fig, ax = plt.subplots() ax.plot(t, s) platiagro.save_figure(experiment_id=EXPERIMENT_ID, operator_id=OPERATOR_ID, run_id=RUN_ID, figure=fig)
def setUp(self): self.maxDiff = None conn = engine.connect() text = (f"INSERT INTO projects (uuid, name, created_at, updated_at) " f"VALUES (%s, %s, %s, %s)") conn.execute(text, ( PROJECT_ID, NAME, CREATED_AT, UPDATED_AT, )) text = ( f"INSERT INTO experiments (uuid, name, project_id, position, is_active, created_at, updated_at) " f"VALUES (%s, %s, %s, %s, %s, %s, %s)") conn.execute(text, ( EXPERIMENT_ID, NAME, PROJECT_ID, POSITION, 1, CREATED_AT, UPDATED_AT, )) text = ( f"INSERT INTO comparisons (uuid, project_id, active_tab, created_at, updated_at) " f"VALUES (%s, %s, %s, %s, %s)") conn.execute(text, ( COMPARISON_ID, PROJECT_ID, 1, CREATED_AT, UPDATED_AT, )) conn.close()
def setUp(self): self.maxDiff = None with open("tests/resources/mocked_deployment.yaml", "r") as file: content = file.read() content = content.replace("$deploymentId", DEPLOYMENT_ID) with open("tests/resources/mocked.yaml", "w") as file: file.write(content) kfp_experiment = kfp_client().create_experiment(name=DEPLOYMENT_ID) kfp_client().run_pipeline( experiment_id=kfp_experiment.id, job_name=DEPLOYMENT_ID, pipeline_package_path="tests/resources/mocked.yaml", ) conn = engine.connect() text = ( f"INSERT INTO tasks (uuid, name, description, image, commands, arguments, tags, parameters, experiment_notebook_path, deployment_notebook_path, is_default, created_at, updated_at) " f"VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)") conn.execute(text, ( TASK_ID, 'name', 'desc', IMAGE, None, None, TAGS_JSON, dumps([]), EX_NOTEBOOK_PATH, DEPLOY_NOTEBOOK_PATH, 0, CREATED_AT, UPDATED_AT, )) text = ( f"INSERT INTO tasks (uuid, name, description, image, commands, arguments, tags, parameters, experiment_notebook_path, deployment_notebook_path, is_default, created_at, updated_at) " f"VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)") conn.execute(text, ( TASK_ID_2, 'name', 'desc', IMAGE, None, None, TAGS_JSON, dumps([]), EX_NOTEBOOK_PATH, None, 0, CREATED_AT, UPDATED_AT, )) text = (f"INSERT INTO projects (uuid, name, created_at, updated_at) " f"VALUES (%s, %s, %s, %s)") conn.execute(text, ( PROJECT_ID, NAME, CREATED_AT, UPDATED_AT, )) text = ( f"INSERT INTO experiments (uuid, name, project_id, position, is_active, created_at, updated_at) " f"VALUES (%s, %s, %s, %s, %s, %s, %s)") conn.execute(text, ( EXPERIMENT_ID, NAME, PROJECT_ID, POSITION, 1, CREATED_AT, UPDATED_AT, )) text = ( f"INSERT INTO deployments (uuid, name, project_id, experiment_id, position, is_active, created_at, updated_at) " f"VALUES (%s, %s, %s, %s, %s, %s, %s, %s)") conn.execute(text, ( DEPLOYMENT_ID, NAME, PROJECT_ID, EXPERIMENT_ID, POSITION, 1, CREATED_AT, UPDATED_AT, )) text = ( f"INSERT INTO deployments (uuid, name, project_id, experiment_id, position, is_active, created_at, updated_at) " f"VALUES (%s, %s, %s, %s, %s, %s, %s, %s)") conn.execute(text, ( DEPLOYMENT_ID_2, NAME, PROJECT_ID, EXPERIMENT_ID, POSITION, 1, CREATED_AT, UPDATED_AT, )) text = ( f"INSERT INTO operators (uuid, experiment_id, deployment_id, task_id, parameters, dependencies, created_at, updated_at) " f"VALUES (%s, %s, %s, %s, %s, %s, %s, %s)") conn.execute(text, ( OPERATOR_ID, EXPERIMENT_ID, DEPLOYMENT_ID, TASK_ID_2, PARAMETERS_JSON, DEP_EMPTY_JSON, CREATED_AT, UPDATED_AT, )) text = ( f"INSERT INTO operators (uuid, experiment_id, deployment_id, task_id, parameters, dependencies, created_at, updated_at) " f"VALUES (%s, %s, %s, %s, %s, %s, %s, %s)") conn.execute(text, ( OPERATOR_ID_2, EXPERIMENT_ID, DEPLOYMENT_ID, TASK_ID, PARAMETERS_JSON, dumps([OPERATOR_ID]), CREATED_AT, UPDATED_AT, )) conn.close()
def setUp(self): self.maxDiff = None conn = engine.connect() text = ( f"INSERT INTO components (uuid, name, description, tags, training_notebook_path, inference_notebook_path, is_default, created_at, updated_at) " f"VALUES ('{COMPONENT_ID}', '{NAME}', '{DESCRIPTION}', '{TAGS_JSON}', '{TRAINING_NOTEBOOK_PATH}', '{INFERENCE_NOTEBOOK_PATH}', 0, '{CREATED_AT}', '{UPDATED_AT}')" ) conn.execute(text) conn.close() try: MINIO_CLIENT.make_bucket(BUCKET_NAME) except BucketAlreadyOwnedByYou: pass file = BytesIO(SAMPLE_NOTEBOOK.encode("utf-8")) MINIO_CLIENT.put_object( bucket_name=BUCKET_NAME, object_name=TRAINING_NOTEBOOK_PATH[len(f"minio://{BUCKET_NAME}/" ):], data=file, length=file.getbuffer().nbytes, ) file = BytesIO( b'{"cells":[{"cell_type":"code","execution_count":null,"metadata":{},"outputs":[],"source":[]}],"metadata":{"kernelspec":{"display_name":"Python 3","language":"python","name":"python3"},"language_info":{"codemirror_mode":{"name":"ipython","version":3},"file_extension":".py","mimetype":"text/x-python","name":"python","nbconvert_exporter":"python","pygments_lexer":"ipython3","version":"3.6.9"}},"nbformat":4,"nbformat_minor":4}' ) MINIO_CLIENT.put_object( bucket_name=BUCKET_NAME, object_name=INFERENCE_NOTEBOOK_PATH[len(f"minio://{BUCKET_NAME}/" ):], data=file, length=file.getbuffer().nbytes, ) session = requests.Session() session.cookies.update(COOKIES) session.headers.update(HEADERS) session.hooks = { "response": lambda r, *args, **kwargs: r.raise_for_status(), } session.put( url=f"{JUPYTER_ENDPOINT}/api/contents/components", data=dumps({ "type": "directory", "content": None }), ) session.put( url=f"{JUPYTER_ENDPOINT}/api/contents/components/{COMPONENT_ID}", data=dumps({ "type": "directory", "content": None }), ) session.put( url= f"{JUPYTER_ENDPOINT}/api/contents/components/{COMPONENT_ID}/Inference.ipynb", data=dumps({ "type": "notebook", "content": loads(SAMPLE_NOTEBOOK) }), ) session.put( url= f"{JUPYTER_ENDPOINT}/api/contents/components/{COMPONENT_ID}/Training.ipynb", data=dumps({ "type": "notebook", "content": loads(SAMPLE_NOTEBOOK) }), )