Skip to main content

Task Metadata - JS/TS

A task object contains task and execution metadata.

Logic TypeAvailable
Generic logic
Aggregator logic

A task is a data process in execution. An execution is a collection of tasks invoked together by a trigger.

Import and Usage

export async function run(ctx) {
const task = ctx.task;
}

export async function handleError(ctx, error) {
const task = ctx.task;
}

Class Reference

Type

  • Task

Properties

PropertyTypeDescription
taskKeyTaskKeyTask ID and execution ID
startTimestampDateTask start datetime
dataProcessVersionedIdentityContextData process identity metadata
currentLogic?VersionedIdentityContextCurrent logic's identity metadata
executedLogicsArray<VersionedIdentityContext>An array of identity metadata of executed logic. Returns an empty array if none exists.

Sub Class Reference

TaskKey

Collection of task and execution ID.

PropertyTypeDescription
taskIdstringTask ID
executionIdstringExecution ID

VersionedIdentityContext

Describes the identity of a logic, data process or other assets in LOC.

PropertyTypeDescription
namestringName
permanentIdentitystringPermanent identity (PID)
revisionnumberRevision number

Examples

// get task ID
const taskId = ctx.task.taskKey.taskId;

// get execution ID
const executionId = ctx.task.taskKey.executionId;

// get current logic's PID
const logicPid = ctx.task.currentLogic.permanentIdentity;

// get the last executed logic's name before current logic (null if none)
const lastLogicName = ctx.task.executedLogics
? ctx.task.executedLogics[ctx.task.executedLogics.length - 1].name
: null;