Is there an existing feature request for this?
What is your feature request?
At the moment, there is only functionality to send notifications using a webhook for job start, success, failure and launch failure. There is also functionality to time out events, but not to let events keep running and instead notify users that events have been running for a long time (and, of course, the user can still terminate the event by aborting it manually if they wish). A pretty straightforward, bare-bones implementation of sending notifications for late running events is described below:
Modifications to the monitorAllActiveJobs function in lib/job.js:
Make monitorAllActiveJobs async
Add const late_threshold = 30 after line 1681 of job.js
Add if (now / 60 - job.time_start / 60 >= late_threshold && !job.late) {job.late = true; const response = await fetch(webhook_url, {method: 'POST', body: JSON.stringify({text: "Job late", id: job.id, event_title: job.event_title,}), headers: {'Content-Type': 'application/json'}});} after line 1695 of job.js
Modifications to rest of file:
job.late = false; (line 215)
This is a bare-bones implementation, as the threshold for an event to be classified as late is hardcoded as 30 minutes. It would be nice if the user could set this threshold themselves for each event via the Cronicle Web UI. It is also sending very minimal data (only text, id, event_title) to the webhook handler, but I'm sure this too could easily be modified to send more job properties.
Code of Conduct
Is there an existing feature request for this?
What is your feature request?
At the moment, there is only functionality to send notifications using a webhook for job start, success, failure and launch failure. There is also functionality to time out events, but not to let events keep running and instead notify users that events have been running for a long time (and, of course, the user can still terminate the event by aborting it manually if they wish). A pretty straightforward, bare-bones implementation of sending notifications for late running events is described below:
Modifications to the monitorAllActiveJobs function in lib/job.js:
Make monitorAllActiveJobs async
Add
const late_threshold = 30after line 1681 of job.jsAdd
if (now / 60 - job.time_start / 60 >= late_threshold && !job.late) {job.late = true; const response = await fetch(webhook_url, {method: 'POST', body: JSON.stringify({text: "Job late", id: job.id, event_title: job.event_title,}), headers: {'Content-Type': 'application/json'}});}after line 1695 of job.jsModifications to rest of file:
job.late = false;(line 215)This is a bare-bones implementation, as the threshold for an event to be classified as late is hardcoded as 30 minutes. It would be nice if the user could set this threshold themselves for each event via the Cronicle Web UI. It is also sending very minimal data (only text, id, event_title) to the webhook handler, but I'm sure this too could easily be modified to send more job properties.
Code of Conduct