APIs for monitoring the status of a job. Use these APIs to wait for a job to enter the specified status. All APIs in monitor jobs invoke z/OSMF jobs REST endpoints to obtain job status information.

export

### Hierarchy

- MonitorJobs

## Index

### Properties

- DEFAULT_ATTEMPTS
- DEFAULT_STATUS
- DEFAULT_WATCH_DELAY
- log

### Methods

- checkStatus
- constructErrorMsg
- pollForStatus
- waitForActiveStatus
- waitForJobOutputStatus
- waitForOutputStatus
- waitForStatusCommon

## Properties

### Static Readonly DEFAULT_ATTEMPTS

DEFAULT_ATTEMPTS: number = Infinity

- Defined in @zowe/zos-jobs-for-zowe-sdk/src/MonitorJobs.ts:47

Default number of poll attempts to check for the specified job status.

static
memberof

  MonitorJobs

### Static Readonly DEFAULT_STATUS

DEFAULT_STATUS: JOB_STATUS = JOB_STATUS.OUTPUT

- Defined in @zowe/zos-jobs-for-zowe-sdk/src/MonitorJobs.ts:40

Default expected job status ("OUTPUT")

static
memberof

  MonitorJobs

### Static Readonly DEFAULT_WATCH_DELAY

DEFAULT_WATCH_DELAY: 3000 = 3000

- Defined in @zowe/zos-jobs-for-zowe-sdk/src/MonitorJobs.ts:33

The default amount of time (in milliseconds) to wait until the next job status poll.

static
memberof

  MonitorJobs

### Static Private log

log: Logger = Logger.getAppLogger()

- Defined in @zowe/zos-jobs-for-zowe-sdk/src/MonitorJobs.ts:188

Obtain an instance of the app logger (Zowe).

static
memberof

  MonitorJobs

## Methods

### Static Private checkStatus

- checkStatus(session: AbstractSession, parms: IMonitorJobWaitForParms): Promise<[boolean, IJob]>

- - Defined in @zowe/zos-jobs-for-zowe-sdk/src/MonitorJobs.ts:265

  Checks the status of the job for the expected status (OR that the job has progressed passed the expected status).

  static
  memberof

    MonitorJobs

  #### Parameters

  - ##### session: AbstractSession

    the session to initiate the z/OSMF getJobStatus request

  - ##### parms: IMonitorJobWaitForParms

    the monitor jobs parameters containing the jobname, jobid, status, etc.

  #### Returns Promise<[boolean, IJob]>

  - promise to fulfill when the job status is obtained (or imperative error)

### Static Private constructErrorMsg

- constructErrorMsg(parms: IMonitorJobWaitForParms, details: string): string

- - Defined in @zowe/zos-jobs-for-zowe-sdk/src/MonitorJobs.ts:299

  Constructs the default error message (to be thrown via ImperativeError) for the monitor jobs APIs

  static
  memberof

    MonitorJobs

  #### Parameters

  - ##### parms: IMonitorJobWaitForParms

    The parameters passed to the API

  - ##### details: string

    Additional error details string

  #### Returns string

  - The error string to be thrown via ImperativeError

### Static Private pollForStatus

- pollForStatus(session: AbstractSession, parms: IMonitorJobWaitForParms): Promise<IJob>

- - Defined in @zowe/zos-jobs-for-zowe-sdk/src/MonitorJobs.ts:199

  "Polls" (sets timeouts and continuously checks) for the status of the job to match the desired status.

  static
  memberof

    MonitorJobs

  #### Parameters

  - ##### session: AbstractSession

    a Rest client session for z/OSMF

  - ##### parms: IMonitorJobWaitForParms

    The monitor jobs parms (see interface for details)

  #### Returns Promise<IJob>

  - Fulfill when the status changes as expected

### Static waitForActiveStatus

- waitForActiveStatus(session: AbstractSession, jobname: string, jobid: string): Promise<IJob>

- - Defined in @zowe/zos-jobs-for-zowe-sdk/src/MonitorJobs.ts:61

  Given the jobname/jobid, waits for the status of the job to be "ACTIVE".

  See JSDoc for "waitForStatusCommon" for full details on polling and other logic.

  static
  memberof

    MonitorJobs

  #### Parameters

  - ##### session: AbstractSession

    a Rest client session for z/OSMF

  - ##### jobname: string

    the z/OS jobname of the job to wait for output status (see z/OSMF Jobs APIs for details)

  - ##### jobid: string

    the z/OS jobid of the job to wait for output status (see z/OSMF Jobs APIS for details)

  #### Returns Promise<IJob>

  - the promise to be fulfilled with IJob object (or rejected with an ImperativeError)

### Static waitForJobOutputStatus

- waitForJobOutputStatus(session: AbstractSession, job: IJob): Promise<IJob>

- - Defined in @zowe/zos-jobs-for-zowe-sdk/src/MonitorJobs.ts:81

  Given an IJob (has jobname/jobid), waits for the status of the job to be "OUTPUT". This API will poll for the OUTPUT status once every 3 seconds indefinitely. If the polling interval/duration is NOT sufficient, use "waitForStatusCommon" to adjust.

  See JSDoc for "waitForStatusCommon" for full details on polling and other logic.

  static
  memberof

    MonitorJobs

  #### Parameters

  - ##### session: AbstractSession

    a Rest client session for z/OSMF

  - ##### job: IJob

    the z/OS job to wait for (see z/OSMF Jobs APIs for details)

  #### Returns Promise<IJob>

  - the promise to be fulfilled with IJob object (or rejected with an ImperativeError)

### Static waitForOutputStatus

- waitForOutputStatus(session: AbstractSession, jobname: string, jobid: string): Promise<IJob>

- - Defined in @zowe/zos-jobs-for-zowe-sdk/src/MonitorJobs.ts:101

  Given the jobname/jobid, waits for the status of the job to be "OUTPUT". This API will poll for the OUTPUT status once every 3 seconds indefinitely. If the polling interval/duration is NOT sufficient, use "waitForStatusCommon" to adjust.

  See JSDoc for "waitForStatusCommon" for full details on polling and other logic.

  static
  memberof

    MonitorJobs

  #### Parameters

  - ##### session: AbstractSession

    a Rest client session for z/OSMF

  - ##### jobname: string

    the z/OS jobname of the job to wait for output status (see z/OSMF Jobs APIs for details)

  - ##### jobid: string

    the z/OS jobid of the job to wait for output status (see z/OSMF Jobs APIS for details)

  #### Returns Promise<IJob>

  - the promise to be fulfilled with IJob object (or rejected with an ImperativeError)

### Static waitForStatusCommon

- waitForStatusCommon(session: AbstractSession, parms: IMonitorJobWaitForParms): Promise<IJob>

- - Defined in @zowe/zos-jobs-for-zowe-sdk/src/MonitorJobs.ts:122

  Given jobname/jobid, checks for the desired "status" (default is "OUTPUT") continuously (based on the interval and attempts specified).

  The "order" of natural job status is INPUT > ACTIVE > OUTPUT. If the requested status is earlier in the sequence than the current status of the job, then the method returns immediately (since the job will never enter the requested status) with the current status of the job.

  static
  memberof

    MonitorJobs

  #### Parameters

  - ##### session: AbstractSession

    a Rest client session for z/OSMF

  - ##### parms: IMonitorJobWaitForParms

    monitor jobs parameters (see interface for details)

  #### Returns Promise<IJob>

  - the promise to be fulfilled with IJob object (or rejected with an ImperativeError)

Generated using TypeDoc