0

Get Job

by
Published today

Get a job (queued, running or completed) by id: status, args, result, timings. Logs are left out; use Get Job Logs for them.

Script windmill Verified

The script

Submitted by hugo989 Typescript (fetch-only)
Verified 4 hours ago
1
//native
2

3
import * as wmill from "windmill-client"
4

5
// windmill-client errors only carry the status text: throw the response body, which says why
6
wmill.OpenAPI.interceptors.response.use(async (response) => {
7
  if (!response.ok) {
8
    throw new Error(`${response.status} ${await response.text()}`)
9
  }
10
  return response
11
})
12

13
/**
14
 * Get Job
15
 * Get a job (queued, running or completed) by id: status, args, result, timings. Logs are left out; use Get Job Logs for them.
16
 */
17
export async function main(id: string) {
18
  return await wmill.JobService.getJob({
19
    workspace: wmill.getWorkspace(),
20
    id,
21
    noLogs: true,
22
  })
23
}
24