Skip to content

Commit

Permalink
Fix pipeline lock acquisition
Browse files Browse the repository at this point in the history
  • Loading branch information
nathandf committed May 14, 2024
1 parent 3743ac7 commit 3f61c32
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions src/api/src/backend/views/PipelineLocks.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,16 +97,12 @@ def post(self, request, group_id, pipeline_id):
raise Exception(f"PipelineLock with UUID {str(pipeline_lock.uuid)} not found.")

# This list of pipeline runs competing for a lock on the pipeline
competing_runs = [
str(lock.pipeline_run)
for lock in pipeline_locks
]
competing_runs = [lock.pipeline_run for lock in pipeline_locks]

# Check to see if the pipeline run associated with the current
# pipeline lock attempt is the next in the queue. If so, update the
# pipeline lock's 'acquired_at' property
print(str(pipeline_lock.pipeline_run.uuid), competing_runs[0])
if str(pipeline_lock.pipeline_run.uuid) == competing_runs[0]:
if str(pipeline_lock.pipeline_run.uuid) == str(competing_runs[0].uuid):
acquired_at = timezone.now()
pipeline_lock.object.update(acquired_at=acquired_at)

Expand Down

0 comments on commit 3f61c32

Please sign in to comment.