Skip to content

Commit

Permalink
Update locks on synclist tasks (#1141)
Browse files Browse the repository at this point in the history
Use shared_resources on calling parent task `curate_all_synclist_repository`
and calling child task `curate_synclist_repository_batch`. This prevents
golden_repo from being written to by another task.

Issue: AAH-1395
  • Loading branch information
awcrosby authored Feb 23, 2022
1 parent 4accea2 commit 1c36735
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 8 deletions.
1 change: 1 addition & 0 deletions CHANGES/1395.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Update locks on synclist tasks so golden_repo will not be written to during tasks
11 changes: 3 additions & 8 deletions galaxy_ng/app/api/v3/viewsets/collection.py
Original file line number Diff line number Diff line change
Expand Up @@ -455,16 +455,11 @@ def move_content(self, request, *args, **kwargs):
).repository

if dest_repo == golden_repo or src_repo == golden_repo:
repo_name = golden_repo.name
locks = [golden_repo]
task_args = (repo_name,)
task_kwargs = {}

curate_task = dispatch(
curate_all_synclist_repository,
exclusive_resources=locks,
args=task_args,
kwargs=task_kwargs
shared_resources=[golden_repo],
args=(golden_repo.name,),
kwargs={},
)
curate_task_id = curate_task.pk

Expand Down
1 change: 1 addition & 0 deletions galaxy_ng/app/tasks/synclist.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ def curate_all_synclist_repository(upstream_repository_name, **kwargs):
dispatch(
curate_synclist_repository_batch,
args=(synclist_ids,),
shared_resources=[upstream_repository],
exclusive_resources=locks,
task_group=task_group,
)
Expand Down

0 comments on commit 1c36735

Please sign in to comment.