From 3c19ff78ec3a73fd54cb89613062b48ba6124a2a Mon Sep 17 00:00:00 2001 From: Dustin Lang Date: Tue, 10 Sep 2024 08:59:48 -0400 Subject: [PATCH] process-submissions: don't fail on empty db --- net/process_submissions.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/net/process_submissions.py b/net/process_submissions.py index 4ad9870c4..980c35fe7 100644 --- a/net/process_submissions.py +++ b/net/process_submissions.py @@ -862,7 +862,7 @@ def main(dojob_nthreads, dosub_nthreads, refresh_rate, max_sub_retries, lastsubs = [] lastjobs = [] - first_maxui = UserImage.objects.aggregate(Max('id'))['id__max'] + first_maxui = UserImage.objects.aggregate(Max('id'))['id__max'] or 0 print('Maximum UserImage id on startup:', first_maxui) n_jobs_done = 0 @@ -880,7 +880,7 @@ def main(dojob_nthreads, dosub_nthreads, refresh_rate, max_sub_retries, if newsubs.count(): print('Found', newsubs.count(), 'unstarted Submissions:', [s.id for s in newsubs]) - maxui = UserImage.objects.aggregate(Max('id'))['id__max'] + maxui = UserImage.objects.aggregate(Max('id'))['id__max'] or 0 print('New UserImages:', maxui-first_maxui, '; Jobs completed:', n_jobs_done) print('Checking for UserImages without Jobs')