// jobs/myJobs.ts
client.defineJob({
  id: "my-job",
  ...
});

// someFile.ts
...
const runs = await client.getRuns("my-job");
if (runs.length === 0) {
  throw new Error("No runs found");
}

const runDetail = await client.getRun(runs[0].id);
console.log(runDetail.tasks.length);
...

Parameters

runId
string
required

The Run ID you want to get the details for

options
Object

Returns

id
string | undefined

The id of the run

status
RunStatus | undefined

The status of the run. Can be one of the following: PENDING, CANCELED, SUCCESS, QUEUED, WAITING_ON_CONNECTIONS, PREPROCESSING, STARTED, FAILURE, TIMED_OUT, ABORTED

startedAt
Date | undefined

The time the run started

completedAt
Date | undefined

The time the run completed

output
any

Whatever you returned from your run function, can be undefined

tasks
Task[]

The tasks from the run

nextCursor
string

If there are more tasks, you can use this to get them

// jobs/myJobs.ts
client.defineJob({
  id: "my-job",
  ...
});

// someFile.ts
...
const runs = await client.getRuns("my-job");
if (runs.length === 0) {
  throw new Error("No runs found");
}

const runDetail = await client.getRun(runs[0].id);
console.log(runDetail.tasks.length);
...