diff --git a/changelog/entries/unreleased/bug/3447_do_not_register_jobs_that_have_unknown_job_type_in_the_job_t.json b/changelog/entries/unreleased/bug/3447_do_not_register_jobs_that_have_unknown_job_type_in_the_job_t.json new file mode 100644 index 000000000..c0d47d725 --- /dev/null +++ b/changelog/entries/unreleased/bug/3447_do_not_register_jobs_that_have_unknown_job_type_in_the_job_t.json @@ -0,0 +1,8 @@ +{ + "type": "bug", + "message": "Do not register jobs that have unknown job type in the job type in the registry.", + "domain": "database", + "issue_number": 3447, + "bullet_points": [], + "created_at": "2025-03-14" +} \ No newline at end of file diff --git a/web-frontend/modules/core/plugins/realTimeHandler.js b/web-frontend/modules/core/plugins/realTimeHandler.js index e642242f6..4808adcfb 100644 --- a/web-frontend/modules/core/plugins/realTimeHandler.js +++ b/web-frontend/modules/core/plugins/realTimeHandler.js @@ -413,7 +413,19 @@ export class RealTimeHandler { }) this.registerEvent('job_started', ({ store }, data) => { - store.dispatch('job/create', data.job) + try { + store.dispatch('job/create', data.job) + } catch (err) { + // TODO: some job types have no frontend handlers (JobType subclasses) + // registered. This will cause an error during creation. The proper fix + // would be to add missing JobTypes. + if ( + err.message !== + `The type ${data.job.type} is not found under namespace job in the registry.` + ) { + throw err + } + } }) } } diff --git a/web-frontend/modules/core/store/job.js b/web-frontend/modules/core/store/job.js index 2ca73f5f8..410607264 100644 --- a/web-frontend/modules/core/store/job.js +++ b/web-frontend/modules/core/store/job.js @@ -5,6 +5,14 @@ const FINISHED_STATES = ['finished', 'failed', 'cancelled'] const STARTING_TIMEOUT_MS = 200 const MAX_POLLING_ATTEMPTS = 100 +/** + * Calls job-type specific routine to enhance job object with any job-type specific + * properties. This may return `null` if job type is not registered. + * + * @param job + * @param registry + * @returns {*|null} + */ export function populateJob(job, registry) { const type = registry.get('job', job.type) return type.populate(job)