Skip to content
This repository was archived by the owner on Jun 19, 2025. It is now read-only.

Commit f2ad769

Browse files
feat(task-cleanup): Deletion of experiment deletes all tasks related to it (#231)
* update identifier of Task from task_id to uuid * remove Task table rows for tasks related to experiment * moved task deletion line to 2 steps earlier * fixed pylint issue by suppressing error * remove backend.delete function call * fix pylint error
1 parent 53db705 commit f2ad769

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

aqueductcore/backend/services/experiment.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -522,11 +522,16 @@ async def remove_experiment(
522522
experiments_root_dir=str(settings.experiments_dir_path), experiment_uuid=experiment_uuid
523523
)
524524

525+
remove_all_experiment_tasks_statement = delete(orm.Task).where(
526+
orm.Task.experiment_id == experiment_uuid
527+
)
528+
await db_session.execute(remove_all_experiment_tasks_statement)
529+
525530
remove_experiment_tag_links_statement = delete(orm.experiment_tag_association).where(
526531
orm.experiment_tag_association.c.experiment_uuid == experiment_uuid
527532
)
528-
529533
await db_session.execute(remove_experiment_tag_links_statement)
534+
530535
remove_experiment_statement = delete(orm.Experiment).where(
531536
orm.Experiment.uuid == experiment_uuid
532537
)

aqueductcore/backend/services/task_executor.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,7 @@
2121
from aqueductcore.backend.context import UserInfo
2222
from aqueductcore.backend.errors import AQDDBTaskNonExisting, AQDPermission
2323
from aqueductcore.backend.models import orm
24-
from aqueductcore.backend.models.task import (TaskProcessExecutionResult,
25-
TaskRead)
24+
from aqueductcore.backend.models.task import TaskProcessExecutionResult, TaskRead
2625
from aqueductcore.backend.services.utils import task_orm_to_model
2726
from aqueductcore.backend.settings import settings
2827

@@ -42,8 +41,9 @@
4241
celery_app.conf.update(result_extended=True)
4342
extension_process = None # pylint: disable=invalid-name
4443

44+
4545
def worker_signal_handler(signo, _):
46-
""" Handle SIGINT signal and propagate it to child and grandchild processes. """
46+
"""Handle SIGINT signal and propagate it to child and grandchild processes."""
4747
global extension_process # pylint: disable=global-statement,global-variable-not-assigned
4848
if extension_process is not None:
4949
psutil_child_process = psutil.Process(extension_process.pid)

0 commit comments

Comments
 (0)