-
Notifications
You must be signed in to change notification settings - Fork 94
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow manual trigger when workflow paused. #6192
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -40,7 +40,9 @@ def push_task(self, itask: 'TaskProxy') -> None: | |
if itask.tdef.name in self.members: | ||
self.deque.appendleft(itask) | ||
|
||
def release(self, active: Counter[str]) -> List['TaskProxy']: | ||
def release( | ||
self, active: Counter[str], is_paused: bool = False | ||
) -> List['TaskProxy']: | ||
"""Release tasks if below the active limit.""" | ||
# The "active" argument counts active tasks by name. | ||
released: List['TaskProxy'] = [] | ||
|
@@ -54,7 +56,10 @@ def release(self, active: Counter[str]) -> List['TaskProxy']: | |
except IndexError: | ||
# deque empty | ||
break | ||
if itask.state.is_held: | ||
if ( | ||
itask.state.is_held or | ||
(is_paused and not itask.is_manual_submit) | ||
): | ||
Comment on lines
+59
to
+62
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We would expect this functionality to work the same across all queue implementations, so we could really do with abstracting it into the base class rather than relying on each queue to implement it separately. Note: If we could bypass the queue entirely that would be ideal. Idea (for future work), write some abstract tests that should hold for all queue implementations. |
||
held.append(itask) | ||
else: | ||
released.append(itask) | ||
|
@@ -114,6 +119,8 @@ def __init__(self, | |
) | ||
|
||
self.force_released: Set['TaskProxy'] = set() | ||
# if paused don't release tasks unless manually triggered | ||
self.is_paused = False | ||
|
||
def push_task(self, itask: 'TaskProxy') -> None: | ||
"""Push a task to the appropriate queue.""" | ||
|
@@ -124,7 +131,7 @@ def release_tasks(self, active: Counter[str]) -> List['TaskProxy']: | |
"""Release tasks up to the queue limits.""" | ||
released: List['TaskProxy'] = [] | ||
for queue in self.queues.values(): | ||
released += queue.release(active) | ||
released += queue.release(active, self.is_paused) | ||
if self.force_released: | ||
released.extend(self.force_released) | ||
self.force_released = set() | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This has gone a little further than that one word change above as we are now continuing to process the queues whilst the workflow is paused making the paused state a little more dynamic than before.
I don't think we actually need to process the entire queue to achieve this, we just need to skip any manually triggered tasks through the queue (ideally bypassing the queue itself if possible).
If we pass
self.is_paused
through torelease_queued_tasks
we could reduce the scope of this override such that it only impacts manually triggered tasks.