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 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 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 delete_mock_dataset(obeject_name): """Delete a mock dataset from Minio. Args: obeject_name (str): dataset name. """ try: for obj in MINIO_CLIENT.list_objects(BUCKET_NAME, prefix=f"datasets/{obeject_name}", recursive=True): MINIO_CLIENT.remove_object(BUCKET_NAME, obj.object_name) except ResponseError as err: print(err)
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 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)