|
17 | 17 | from galaxy.exceptions import HandlerAssignmentError |
18 | 18 | from galaxy.jobs.handler import InvocationGrabber |
19 | 19 | from galaxy.model.base import check_database_connection |
| 20 | +from galaxy.model.orm.now import now |
20 | 21 | from galaxy.schema.invocation import ( |
21 | 22 | FailureReason, |
22 | 23 | InvocationFailureDatasetFailed, |
@@ -350,12 +351,12 @@ def ready_to_schedule_more(self, invocation: model.WorkflowInvocation): |
350 | 351 | invocation_step_update_time := invocation.get_last_workflow_invocation_step_update_time() |
351 | 352 | ): |
352 | 353 | do_schedule = invocation_step_update_time > last_schedule_time |
353 | | - if not do_schedule and (datetime.now() - last_schedule_time) > self.timedelta: |
| 354 | + if not do_schedule and (now() - last_schedule_time) > self.timedelta: |
354 | 355 | # If we haven't scheduled in a while, schedule anyway. |
355 | 356 | log.debug( |
356 | 357 | "Scheduling workflow invocation [%s] after %s seconds without scheduling.", |
357 | 358 | invocation.id, |
358 | | - (datetime.now() - last_schedule_time).total_seconds(), |
| 359 | + (now() - last_schedule_time).total_seconds(), |
359 | 360 | ) |
360 | 361 | do_schedule = True |
361 | 362 | return do_schedule |
@@ -459,7 +460,7 @@ def __attempt_schedule(self, invocation_id, workflow_scheduler): |
459 | 460 | if i.active and i.id < workflow_invocation.id: |
460 | 461 | return False |
461 | 462 | if self.ready_to_schedule_more(workflow_invocation): |
462 | | - self.update_time_tracking_dict[invocation_id] = datetime.now() |
| 463 | + self.update_time_tracking_dict[invocation_id] = now() |
463 | 464 | workflow_scheduler.schedule(workflow_invocation) |
464 | 465 | log.debug("Workflow invocation [%s] scheduled", invocation_id) |
465 | 466 | except Exception: |
|
0 commit comments