Jobs

@thotnr-aws-accl/custom-app-api / Exports / Jobs

Class: Jobs

Execute and view the status of background jobs

Table of contents

Methods

Methods

executeJob

Static executeJob(jobCode, additionalProps?, onStepProgress?, onJobError?): Promise<JobExecution>

Execute a job and get the job execution status

Parameters

Name
Type
Description

jobCode

string

The job code to execute

additionalProps

string | object

Additional properties to pass to the job

onStepProgress?

(stepExecutionProgressLog: StepExecutionProgressLog) => void

Callback to receive progress of the job

onJobError?

(error: UnknownError) => void

Callback to receive error of the job

Returns

Promise<JobExecution>

The job execution status


executeJobV2

Static executeJobV2(jobCode, additionalProps, onStepProgress?, onJobError?): Promise<JobExecution>

Execute a job and get the job execution status

Parameters

Name
Type
Description

jobCode

string

The job code to execute

additionalProps

JobAdditionalProperties

Additional properties to pass to the job

onStepProgress?

(stepExecutionProgressLog: StepExecutionProgressLog) => void

Callback to receive progress of the job

onJobError?

(error: UnknownError) => void

Callback to receive error of the job

Returns

Promise<JobExecution>

The job execution status


getALlMlCodesForCurrentApp

Static getALlMlCodesForCurrentApp(): Promise<readonly string[]>

This method is used to fetch all Machine Learning (ML) codes for the current application.

Returns

Promise<readonly string[]>

A Promise that resolves to a readonly array of strings representing the ML codes.


getAllJobExecutions

Static getAllJobExecutions(jobExecutionId): Promise<JobExecution[]>

Fetches all the job executions for the given job execution ids

Parameters

Name
Type
Description

jobExecutionId

number[]

The job execution ids for which the job executions are to be fetched

Returns

Promise<JobExecution[]>

The job executions for the given job execution ids


getAllJobExecutionsAndAdditionalPropsByExecutionProfile

Static getAllJobExecutionsAndAdditionalPropsByExecutionProfile(params): Promise<JobExecution[]>

This method fetches all job executions and their additional properties based on the provided execution profile ID and job code.

Parameters

Name
Type
Description

params

Object

An object containing the execution profile ID and job code.

params.executionProfileId

string

The execution profile ID.

params.groupByExecutionProfileId?

boolean

Whether to group jobs by execution profile ID. When enabled, this option fetches the latest job execution (sorted by created_date) for each execution profile ID. Defaults to true.

params.isExpandJobInfo?

boolean

Whether to fetch job information such as job name, job code etc. When disabled, the return value will not have the job information. Defaults to true.

params.jobCode

string

The job code.

Returns

Promise<JobExecution[]>

A Promise that resolves to an array of JobExecution or undefined if no job executions are found.

Throws

If no matching execution profile objects are found or more than one matching execution profile objects are found.


getAllJobExecutionsAndAdditionalPropsByMultipleExecutionProfile

Static getAllJobExecutionsAndAdditionalPropsByMultipleExecutionProfile(searchParam, isExpandJobInfo?, groupByExecutionProfileId?, fetchJobsAsHttpPost?): Promise<JobExecution[]>

This method fetches all job executions and their additional properties based on the provided searchParam each searchParam has an executionProfileId and JobCode execution profile ID and job code.

Parameters

Name
Type
Description

searchParam

{ executionProfileId: string ; jobCode: string }[]

isExpandJobInfo?

boolean

Whether to fetch job information such as job name, job code, etc. When disabled, the return value will not have the job information. Defaults to true.

groupByExecutionProfileId?

boolean

Whether to group jobs by execution profile ID. When enabled, this option fetches the latest job execution (sorted by created_date) for each execution profile ID. Defaults to true.

fetchJobsAsHttpPost?

boolean

Whether to fetch the jobs as HTTP POST (to avoid HTTP 414) during filtration

Returns

Promise<JobExecution[]>


getAllJobExecutionsWithSearchParams

Static getAllJobExecutionsWithSearchParams(searchParams): Promise<JobExecution[]>

This method fetches all job executions based on the provided search parameters. It uses the JobResourceClient to get the jobs based on the search parameters. If no jobs are found, it returns undefined. Otherwise, it maps each job to its execution status.

Parameters

Name
Type
Description

searchParams

JobSearchFilters

{JobSearchFilters} The search parameters to filter the job executions.

Returns

Promise<JobExecution[]>

A Promise that resolves to an array of JobExecution or undefined if no jobs are found.


getAllRunIdsByExecutionProfile

Static getAllRunIdsByExecutionProfile(executionProfileId, jobCode): Promise<string[]>

Fetches distinct runIds by execution profileId and JobCode

Parameters

Name
Type

executionProfileId

string

jobCode

string

Returns

Promise<string[]>

Deprecated


getAvailableAgentLabels

Static getAvailableAgentLabels(): Promise<string[]>

Get all available Agent Labels

Returns

Promise<string[]>


getJobCodeMLCodeMapping

Static getJobCodeMLCodeMapping(): Promise<Map<string, string[]>>

This method is used to fetch all Machine Learning (ML) codes for the current application by JobCodes.

Returns

Promise<Map<string, string[]>>


getJobExecution

Static getJobExecution(jobExecutionId): Promise<JobExecution>

Get the status of a job execution

Parameters

Name
Type
Description

jobExecutionId

number | { jobExecutionId: number }

The job execution id

Returns

Promise<JobExecution>

The job execution status


getJobExecutionStepLogs

Static getJobExecutionStepLogs(jobExecutionId, pageSize?): Promise<StepExecutionProgressLog[]>

Fetches the logs for the given job execution id

Parameters

Name
Type
Description

jobExecutionId

number

The job execution id for which the job logs are to be fetched

pageSize?

number

Returns

Promise<StepExecutionProgressLog[]>

The logs for the given job execution id


getJobExecutionSteps

Static getJobExecutionSteps(«destructured»): Promise<JobStep[]>

Get the steps for a job execution. There are cases such as iteration, python mappings and java mappings where the objects being written will not be known at the design time. Instead, they are dynamic and only available after the job has execution. In such cases, this method should be used to determine the objects being written for a specific job id. Note: This will not return the objects being read dynamically using python and java.

Parameters

Name
Type

«destructured»

Object

jobExecutionId

number

skipObjectDetails?

boolean

Returns

Promise<JobStep[]>

The steps for the given job execution id


getJobSteps

Static getJobSteps(jobCode, isSkipObjectDetails?): Promise<JobStep[]>

Get the steps for a job

Parameters

Name
Type
Description

jobCode

string

The job code for which the steps are to be fetched

isSkipObjectDetails?

boolean

If true, skips retrieving the write batches for the job execution id

Returns

Promise<JobStep[]>

The steps for the given job code


getJobStepsV2

Static getJobStepsV2(«destructured»): Promise<JobStep[]>

Get the steps for a job

Parameters

Name
Type

«destructured»

Object

jobCode

string

skipObjectDetails?

boolean

Returns

Promise<JobStep[]>

The steps for the given job code


getParentMappingbyJobCode

Static getParentMappingbyJobCode(jobCode): Promise<ProxyMappingProps>

Get the steps for a job

Parameters

Name
Type
Description

jobCode

string

The job code for which the steps are to be fetched

Returns

Promise<ProxyMappingProps>

The Proxy Mapping option details for the given job code


publishJobData

Static publishJobData(jobExecutionId): Promise<void>

publishes data for a job execution

Parameters

Name
Type
Description

jobExecutionId

number

the job execution id for which data has to be published

Returns

Promise<void>


stopJobExecution

Static stopJobExecution(jobId, onJobStop?, onJobStopError?): Promise<void>

Execute a job stop and get the job stop status

Parameters

Name
Type
Description

jobId

number

The job code to execute

onJobStop?

(output: any) => void

Callback to receive progress of the job stop

onJobStopError?

(error: UnknownError) => void

Callback to receive error of the job stop

Returns

Promise<void>

A Promise that resolves to void or undefined

Last updated