Class: Executions

repositories.Executions

Executions repository.

The Executions class allows the user to manage executions and their properties.

Hierarchy

Implements

Table of contents

Constructors

Methods

Constructors

constructor

new Executions(agent)

Creates an instance of Repository.

Parameters

Name Type
agent PeerAgent

Inherited from

Repository .constructor

Methods

create

create(payload): Promise<SDKExecution>

Creates a new execution.

Example

Copy
Copied
const execution = await dl.executions.create({
    functionName: 'My Function',
    serviceName: 'My Service',
    input: { dataset_id: 'datasetId-123', name: 'My first input' },
})
  • To receive updates on the execution status, subscribe to the DlEvent.EXECUTION_STATUS event, which is triggered upon creation, success, and failure.
    Copy
    Copied
    await dl.on(DlEvent.EXECUTION_STATUS, (payload: { execution: SDKExecution, status: 'created' | 'success' | 'failed' }) => {
    console.log(`Execution ${payload.execution.id} status: ${payload.status}`)
    console.log(`Execution output`, payload.execution.output)
    })

    Parameters

Name Type Description
payload SDKExecutionPayload An object containing the execution's payload.

Returns

Promise<SDKExecution>

  • A promise that resolves to the created execution.

get

get(executionId): Promise<SDKExecution>

Retrieves an execution.

Example

Copy
Copied
const execution = await dl.executions.get('executionId-123')

Parameters

Name Type Description
executionId string The execution's id.

Returns

Promise<SDKExecution>

  • A promise that resolves to the execution.