Schedule error handler template

Script windmill Verified

by hugo697 ยท 7/6/2023

The script

Submitted by hugo697 Bun
Verified 331 days ago
1
// Schedule error handler template
2

3
export async function main(
4
  workspace_id: string, // The ID of the workspace that the schedule belongs to
5
  job_id: string, // The UUID of the job that errored
6
  path: string, // The path of the script or flow that errored
7
  is_flow: boolean, // Whether the runnable is a flow
8
  schedule_path: string, // The path of the schedule
9
  error: object, // The error details
10
  started_at: string, // The start datetime of the latest job that failed
11
  failed_times: number // Minimum number of times the schedule failed before calling the error handler
12
) {
13
  console.log(
14
    `Schedule ${schedule_path} failed ${failed_times > 1 ? failed_times + " times in a row" : ""}\n${
15
      is_flow ? "Flow" : "Script"
16
    }: ${path}`
17
  );
18
  console.log(`Last failed job started at ${started_at}:`, error);
19
  return error;
20
}
21

Other submissions
  • Submitted by hugo697 Deno
    Created 959 days ago
    1
    // Schedule error handler template
    2
    
    
    3
    export async function main(
    4
      path: string, // The path of the script or flow that errored
    5
      is_flow: boolean, // Whether the runnable is a flow
    6
      schedule_path: string, // The path of the schedule
    7
      error: object, // The error details
    8
      started_at: string, // The start datetime of the latest job that failed
    9
      failed_times: number // Minimum number of times the schedule failed before calling the error handler
    10
    ) {
    11
      console.log(
    12
        `Schedule ${schedule_path} failed ${
    13
          failed_times > 1 ? failed_times + " times in a row" : ""
    14
        }\n${is_flow ? "Flow" : "Script"}: ${path}`
    15
      );
    16
      console.log(`Last failure at ${started_at}:`, error);
    17
      return error;
    18
    }
    19