Skip to content

JobMethods

Methods available on job response objects. These are bound to the job data and delegate to the service.

Methods

getOutput()

getOutput(): Promise<null | Record<string, unknown>>

Gets the output of this job.

Retrieves the job's output arguments, handling both inline output (stored directly on the job as a JSON string in outputArguments) and file-based output (stored as a blob attachment for large outputs). Returns the parsed JSON output or null if the job has no output.

Returns

Promise<null | Record<string, unknown>>

Promise resolving to the parsed output as Record<string, unknown>, or null if no output exists

Example

const allJobs = await jobs.getAll();
const completedJob = allJobs.items.find(j => j.state === JobState.Successful);

if (completedJob) {
  const output = await completedJob.getOutput();
}

restart()

restart(): Promise<JobGetResponse>

Restarts this job, creating a new execution with a new key.

Returns

Promise<JobGetResponse>

Promise resolving to the new JobGetResponse with full job details


resume()

resume(options?: JobResumeOptions): Promise<void>

Resumes this suspended job.

Parameters

Parameter Type Description
options? JobResumeOptions Optional parameters including input arguments

Returns

Promise<void>

Promise that resolves when the job is resumed successfully, or rejects on failure


stop()

stop(options?: JobStopOptions): Promise<void>

Stops this job.

Sends a stop request for this job to the Orchestrator.

Parameters

Parameter Type Description
options? JobStopOptions Optional JobStopOptions including stop strategy (defaults to SoftStop)

Returns

Promise<void>

Promise that resolves when the jobs are stopped successfully, or rejects on failure

Example

const allJobs = await jobs.getAll({ folderId: <folderId> });
const runningJob = allJobs.items.find(j => j.state === JobState.Running);

if (runningJob) {
  await runningJob.stop();
}