示例#1
0
    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()
示例#2
0
    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()
示例#3
0
    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)
示例#4
0
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)
示例#5
0
    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()
示例#6
0
 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)