---
title: Job
slug: data-platform/connect-platform/app-sdk-api-reference-classes-job
docTags: 
createdAt: 2026-08-05T20:06:34.632Z
---

[OCP App SDK](docId\:gxEU_0AA37IEZJK-uoVcT)

***

[OCP App SDK](docId\:gxEU_0AA37IEZJK-uoVcT) / Job

# Class: `abstract` Job

Defined in: [src/app/Job.ts:41](https://github.com/ZaiusInc/app-sdk/blob/8c7209817facb226c91abb960e6d54a7692b9aa2/src/app/Job.ts#L41)

## Constructors

### Constructor

:::BlockQuote
**new Job**(`invocation`): `Job`
:::

Defined in: [src/app/Job.ts:61](https://github.com/ZaiusInc/app-sdk/blob/8c7209817facb226c91abb960e6d54a7692b9aa2/src/app/Job.ts#L61)

Initializes a job to be run

### Parameters

### invocation

[`` `JobInvocation` ``](docId\:doEVjKAh3GyTqVxA6o8GM)

details of the job invocation

### Returns

`Job`

## Properties

### invocation

:::BlockQuote
`protected` **invocation**: [`` `JobInvocation` ``](docId\:doEVjKAh3GyTqVxA6o8GM)
:::

Defined in: [src/app/Job.ts:61](https://github.com/ZaiusInc/app-sdk/blob/8c7209817facb226c91abb960e6d54a7692b9aa2/src/app/Job.ts#L61)

details of the job invocation

***

### isInterruptible

:::BlockQuote
**isInterruptible**: `boolean` = `false`
:::

Defined in: [src/app/Job.ts:53](https://github.com/ZaiusInc/app-sdk/blob/8c7209817facb226c91abb960e6d54a7692b9aa2/src/app/Job.ts#L53)

Set this to true during an interruptible operation, such as waiting for a long running export.
When true, a job can be interrupted and resumed with the PREVIOUS Job state (the one perform was last called with).
A job is normally expected to complete a job loop (perform) within \< 60s. Your job CAN perform a loop for longer
than 60 seconds if isInterruptible is set to true for a significant part of each 60 seconds of runtime
and is performing NON-BLOCKING operations.

### IMPORTANT

You MUST ensure the process is **NOT BLOCKED** while interruptible. This can be achieved
by manually calling `await this.sleep()` regularly or is automatic if you are waiting on non-blocking calls.

`Job::sleep` and `Job::performInterruptibleTask` will set this value automatically.

## Methods

### perform()

:::BlockQuote
`abstract` **perform**(`status`): `Promise`\<[`` `JobStatus` ``](docId\:d0U9cE7REmq4XlLlB8cyH)>
:::

Defined in: [src/app/Job.ts:81](https://github.com/ZaiusInc/app-sdk/blob/8c7209817facb226c91abb960e6d54a7692b9aa2/src/app/Job.ts#L81)

Performs a unit of work. Jobs should perform a small unit of work and then return the current state.
Perform is automatically called in a loop where the previously returned state will be given to the next iteration.
Iteration will continue until complete is set to true in the returned job status.

### Parameters

### status

[`` `JobStatus` ``](docId\:d0U9cE7REmq4XlLlB8cyH)

last known job state and status

### Returns

`Promise`\<[`` `JobStatus` ``](docId\:d0U9cE7REmq4XlLlB8cyH)>

The current JobStatus/state that can be used to perform the next iteration or resume a job if interrupted.

***

### performInterruptibleTask()

:::BlockQuote
`protected` **performInterruptibleTask**\<`T`>(`task`): `Promise`\<`T`>
:::

Defined in: [src/app/Job.ts:90](https://github.com/ZaiusInc/app-sdk/blob/8c7209817facb226c91abb960e6d54a7692b9aa2/src/app/Job.ts#L90)

Wrapper for interruptible tasks, such as waiting for a long api call or a timeout loop waiting for a result.
Interruptible tasks MUST BE NON-BLOCKING or must manually call `await this.sleep()` regularly (every few seconds).

### Type Parameters

### T

`T`

### Parameters

### task

() => `Promise`\<`T`>

### Returns

`Promise`\<`T`>

### Usage

`const result = await this.performInterruptibleTask(() => fetch(...)));`
In this example, the job can be interrupted during the fetch operation, and if interrupted will be resumed
with the previous job state.

***

### prepare()

:::BlockQuote
`abstract` **prepare**(`params`, `status?`, `resuming?`): `Promise`\<[`` `JobStatus` ``](docId\:d0U9cE7REmq4XlLlB8cyH)>
:::

Defined in: [src/app/Job.ts:72](https://github.com/ZaiusInc/app-sdk/blob/8c7209817facb226c91abb960e6d54a7692b9aa2/src/app/Job.ts#L72)

Prepares to run a job. Prepare is called at the start of a job
and again only if the job was interrupted and is being resumed.
Use this function to read secrets and establish connections to simplify the job loop (perform).

### Parameters

### params

[`` `ValueHash` ``](docId\:iBlCGxR75KaoapohMUe5k)

a hash if params were supplied to the job run, otherwise an empty hash

### status?

[`` `JobStatus` ``](docId\:d0U9cE7REmq4XlLlB8cyH)

provided ONLY if the job was interrupted and should continue from the last known state

### resuming?

`boolean`

if the job was interrupted, resuming will be set to true when it is resumed

### Returns

`Promise`\<[`` `JobStatus` ``](docId\:d0U9cE7REmq4XlLlB8cyH)>

***

### sleep()

:::BlockQuote
`protected` **sleep**(`miliseconds?`, `options?`): `Promise`\<`void`>
:::

Defined in: [src/app/Job.ts:110](https://github.com/ZaiusInc/app-sdk/blob/8c7209817facb226c91abb960e6d54a7692b9aa2/src/app/Job.ts#L110)

Sleep the job without CPU thrashing. Use this method to wait for long running tasks, like an export API.

### Parameters

### miliseconds?

`number`

duration to sleep in miliseconds

### options?

[`` `SleepOptions` ``](docId:5XwlTQcuBpoVYPEDZVJda)

`{interruptible: true}` if the job can be interrupted while sleeping.
A sleep that is not interruptible cannot safely be longer than about 55 seconds.

### Returns

`Promise`\<`void`>

### Usage

`await this.sleep(5000);`
