Skip to content

Commit

Permalink
fix: check if there are no queued jobs
Browse files Browse the repository at this point in the history
  • Loading branch information
duhow committed Apr 23, 2024
1 parent cdee922 commit f9ca087
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,10 +128,14 @@ def process_workflow_job():
def monitor_queued_jobs():
"""Return the job that has been queued and not starting for long time."""
app.logger.debug("Starting monitor_queued_jobs")

if not jobs:
return

queued_jobs = [job for job in jobs.values() if job.action == "queued"]
if not queued_jobs:
return

job = min(queued_jobs, key=lambda x: x.time_start)
delay = (datetime.now() - job.time_start).seconds

Expand Down

0 comments on commit f9ca087

Please sign in to comment.