Skip to content

Commit 1d135f4

Browse files
committed
Also consider workflow invocation step update time
1 parent e8dac6b commit 1d135f4

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

lib/galaxy/model/__init__.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8995,6 +8995,13 @@ class WorkflowInvocation(Base, UsesCreateAndUpdateTime, Dictifiable, Serializabl
89958995
states = InvocationState
89968996
non_terminal_states = [states.NEW, states.READY]
89978997

8998+
def get_last_workflow_invocation_step_update_time(self) -> Optional[datetime]:
8999+
session = required_object_session(self)
9000+
stmt = select(func.max(WorkflowInvocationStep.update_time)).where(
9001+
WorkflowInvocationStep.workflow_invocation_id == self.id
9002+
)
9003+
return session.execute(stmt).scalar_one_or_none()
9004+
89989005
def create_subworkflow_invocation_for_step(self, step):
89999006
assert step.type == "subworkflow"
90009007
subworkflow_invocation = WorkflowInvocation()

lib/galaxy/workflow/scheduling_manager.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,12 @@ def ready_to_schedule_more(self, invocation: model.WorkflowInvocation):
323323
else:
324324
last_schedule_time = self.update_time_tracking_dict[invocation.id]
325325
last_history_update_time = invocation.history.update_time
326-
return last_history_update_time > last_schedule_time
326+
do_schedule = last_history_update_time > last_schedule_time
327+
if not do_schedule and (
328+
invocation_step_update_time := invocation.get_last_workflow_invocation_step_update_time()
329+
):
330+
return invocation_step_update_time > last_schedule_time
331+
return do_schedule
327332

328333
def __monitor(self):
329334
to_monitor = self.workflow_scheduling_manager.active_workflow_schedulers

0 commit comments

Comments
 (0)