From 04e1aa14b5b6e0950730e9a7d8b066ce116dccdd Mon Sep 17 00:00:00 2001 From: Jorrit Boekel Date: Thu, 21 Nov 2024 11:13:51 +0100 Subject: [PATCH] Fix error in frontend not showing files in home, fix 500 error in datasets populating, fix job runner not running jobs that have another job before them in chain that is in waiting state --- src/backend/home/views.py | 4 ++-- src/backend/jobs/management/commands/runjobs.py | 2 +- src/frontend/home/src/Files.svelte | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/backend/home/views.py b/src/backend/home/views.py index 2947914e..8d53c367 100644 --- a/src/backend/home/views.py +++ b/src/backend/home/views.py @@ -458,13 +458,13 @@ def populate_proj(dbprojs, user, showjobs=True, include_db_entry=False): def populate_dset(dsids, dbdsets, user): dsets = OrderedDict() - jobmap = defaultdict(dict) + jobmap = defaultdict(list) for job in jm.Job.objects.filter( filejob__storedfile__rawfile__datasetrawfile__dataset_id__in=dsids ).exclude(state__in=jj.JOBSTATES_DONE).distinct('pk').values('state', 'pk', 'filejob__storedfile__rawfile__datasetrawfile__dataset_id'): dsid = job['filejob__storedfile__rawfile__datasetrawfile__dataset_id'] - jobmap[dsid][str(job['pk'])] = job['state'] + jobmap[dsid].append((str(job['pk']), job['state'])) for dset in dbdsets.values('pk', 'deleted', 'runname__experiment__project__projtype__ptype_id', 'runname__experiment__name', 'runname__experiment__project__projtype__ptype__name', 'runname__experiment__project__name', 'runname__name', 'datatype__name', diff --git a/src/backend/jobs/management/commands/runjobs.py b/src/backend/jobs/management/commands/runjobs.py index 617c57b5..48534471 100644 --- a/src/backend/jobs/management/commands/runjobs.py +++ b/src/backend/jobs/management/commands/runjobs.py @@ -40,7 +40,7 @@ def run_ready_jobs(job_fn_map, job_ds_map, active_jobs): # Jobs that changed to waiting are excluded from active # Jobs that are on HOLD also, because they will get added to active when encountered # This way they will only seen as active to jobs after the held job - wait_jobs = Job.objects.filter(state=[Jobstates.WAITING, Jobstates.HOLD], + wait_jobs = Job.objects.filter(state__in=[Jobstates.WAITING, Jobstates.HOLD], pk__in=active_jobs).values('pk') active_jobs.difference_update([x['pk'] for x in wait_jobs]) for job in jobs_not_finished: diff --git a/src/frontend/home/src/Files.svelte b/src/frontend/home/src/Files.svelte index 777b2f95..a6732183 100644 --- a/src/frontend/home/src/Files.svelte +++ b/src/frontend/home/src/Files.svelte @@ -15,7 +15,7 @@ let fetchingCleanup = false; let treatItems; const tablefields = [ - {id: 'jobs', name: '__hourglass-half', type: 'state', multi: true, links: 'job_ids', linkroute: '#/jobs'}, + {id: 'jobstate', name: '__hourglass-half', type: 'state', multi: true, links: 'job_ids', linkroute: '#/jobs'}, {id: 'name', name: 'File', type: 'str', multi: false}, {id: 'smallstatus', name: '', type: 'smallcoloured', multi: true}, {id: 'dataset', name: '', type: 'icon', help: 'Dataset', icon: 'clipboard-list', multi: false, links: 'dataset', linkroute: '#/datasets'},