Edits history of script submission #22579 for ' List Queued Jobs (windmill)'

  • bunnative
    One script reply has been approved by the moderators
    Ap­pro­ved
    //native
    
    import * as wmill from "windmill-client"
    
    // windmill-client errors only carry the status text: throw the response body, which says why
    wmill.OpenAPI.interceptors.response.use(async (response) => {
      if (!response.ok) {
        throw new Error(`${response.status} ${await response.text()}`)
      }
      return response
    })
    
    /**
     * List Queued Jobs
     * List jobs in the queue (waiting, running or suspended), with optional filters on path, creator and state.
     */
    export async function main(
      script_path_exact: string | undefined,
      script_path_start: string | undefined,
      schedule_path: string | undefined,
      created_by: string | undefined,
      state: "any" | "running" | "waiting" | "suspended" = "any",
      page: number | undefined,
      per_page: number | undefined
    ) {
      return await wmill.JobService.listQueue({
        workspace: wmill.getWorkspace(),
        scriptPathExact: script_path_exact || undefined,
        scriptPathStart: script_path_start || undefined,
        schedulePath: schedule_path || undefined,
        createdBy: created_by || undefined,
        running:
          state === "running" ? true : state === "waiting" ? false : undefined,
        suspended: state === "suspended" ? true : undefined,
        page: page ?? undefined,
        perPage: per_page ?? undefined,
      })
    }
    

    Submitted by hugo989 19 days ago

  • bunnative
    //native
    
    import * as wmill from "windmill-client@1";
    
    export async function main(
      scriptPathExact?: string,
      onlySuspendedJobs: boolean
    ) {
      return wmill.JobService.listQueue({
        workspace: wmill.getWorkspace(),
        suspended: onlySuspendedJobs,
        perPage: 50,
        scriptPathExact,
      });
    }
    

    Submitted by hugo989 152 days ago