Skip to main content
Version: LOC v0.7 (legacy)

Context and Task

Data Context is an object injected into logic functions at runtime, which containes some key components:

  • Task and execution-related information
  • Trigger payload

Before LOC v0.7.0, agents are also part of the context object. Still, context, tasks and payloads have strong ties with agents and are in fact often used together.

Availability

  • ✓ Generic logic
  • ✓ Aggregator logic

Context

When a logic gets executed, a data context object ctx will be available in both run and handleError functions:

export async function run(ctx) {
// ctx is the data context
}

Task

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

A task is an execution of this particular data process.

MemberTypeDescription
taskIdtaskId, which is { id: string, executionId: string }Task ID and execution ID
startAtDateTask start date
dataProcessIdentityContext (see below)Data process permanent ID
currentLogicIdentityContextCurrent logic permanent ID
executedLogicsArray<IdentityContext>An array of identity of executed logic

Type IdentityContext represents the identity of a logic or a data process:

MemberTypeDescription
namestringName
permanentIdentitystringPermanent identity string
revisionnumberRevision number

Example

const taskId = ctx.task.taskId.id;
const executionId = ctx.task.taskId.executionId;
const pid = ctx.task.dataProcess.permanentIdentity;