Skip to content

Latest commit

 

History

History
515 lines (385 loc) · 13.2 KB

execution-event-logs.md

File metadata and controls

515 lines (385 loc) · 13.2 KB

Execution event logs

Table of contents

Events

Execution events are represented as plain objects, and all of them share two common fields:

  • type: A string that indicates the type of the event being produced.
  • timestamp: The Unix timestamp in milliseconds, representing the time at which the event was produced.

In turn, each type of event may contain additional fields containing supplementary data associated with the event.

Types of events

ExecutionStarted event

The ExecutionStarted event is produced when the execution is started.

Additional fields

  • input: Input value passed to the execution.

Example

{
    type: 'ExecutionStarted',
    timestamp: 1234567890123,
    input: { id: 5, coordX: '12.638614', coordY: '-36.581396' }
}

ExecutionSucceeded event

The ExecutionSucceeded event is produced when the execution ends successfully.

Additional fields

  • output: Output value produced by the execution.

Example

{
    type: 'ExecutionSucceeded',
    timestamp: 1234567890123,
    output: [55, 99, 22]
}

ExecutionFailed event

The ExecutionFailed event is produced when the execution encounters an error and fails.

Additional fields

  • Error: Name of the error that caused the failure.
  • Cause: This field can either be a string or an object:
    • string: Contains a description explaining why the execution failed.
    • object: Contains details that provide more information as to why the execution failed.

Example

{
    type: 'ExecutionFailed',
    timestamp: 1234567890123,
    Error: 'TypeError',
    Cause: "Cannot read properties of undefined (reading '0')"
}

ExecutionAborted event

The ExecutionAborted event is produced when the execution is aborted by calling the abort function returned by the StateMachine.run method.

Additional fields

None.

Example

{
    type: 'ExecutionAborted',
    timestamp: 1234567890123
}

ExecutionTimeout event

The ExecutionTimeout event is produced when the execution times out because the execution ran longer than the number of seconds specified in the TimeoutSeconds top-level field.

Additional fields

None.

Example

{
    type: 'ExecutionTimeout',
    timestamp: 1234567890123
}

MapIterationStarted event

The MapIterationStarted event is produced when an iteration in a Map state has started.

Additional fields

  • parentState: An object of type StateData containing data associated with the Map state to which this iteration belongs to.
  • index: The index of this iteration.
  • input: Input value passed to the iteration.

Example

{
    type: 'MapIterationStarted',
    timestamp: 1234567890123,
    parentState: {
        name: 'MapState',
        type: 'Map',
        input: [
            { prod: "R31", dest-code: 9511, quantity: 1344 },
            { prod: "S39", dest-code: 9511, quantity: 40 }
        ]
    },
    index: 0,
    input: { prod: "R31", dest-code: 9511, quantity: 1344 }
}

MapIterationSucceeded event

The MapIterationSucceeded event is produced when an iteration in a Map state ends successfully.

Additional fields

  • parentState: An object of type StateData containing data associated with the Map state to which this iteration belongs to.
  • index: The index of this iteration.
  • output: Output value produced by the iteration.

Example

{
    type: 'MapIterationSucceeded',
    timestamp: 1234567890123,
    parentState: {
        name: 'MapState',
        type: 'Map',
        input: [
            { prod: "R31", dest-code: 9511, quantity: 1344 },
            { prod: "S39", dest-code: 9511, quantity: 40 }
        ]
    },
    index: 0,
    output: true
}

MapIterationFailed event

The MapIterationFailed event is produced when an iteration in a Map encounters an error and fails.

Additional fields

  • parentState: An object of type StateData containing data associated with the Map state to which this iteration belongs to.
  • index: The index of this iteration.
  • Error: Name of the error that caused the failure.
  • Cause: This field can either be a string or an object:
    • string: Contains a description explaining why the iteration failed.
    • object: Contains details that provide more information as to why the iteration failed.

Example

{
    type: 'MapIterationFailed',
    timestamp: 1234567890123,
    parentState: {
        name: 'MapState',
        type: 'Map',
        input: [
            { prod: "R31", dest-code: 9511, quantity: 1344 },
            { prod: "S39", dest-code: 9511, quantity: 40 }
        ]
    },
    index: 0,
    Error: 'CustomProcessingError',
    Cause: 'Could not process item with id `R31` sucessfully'
}

ParallelBranchStarted event

The ParallelBranchStarted event is produced when a branch in a Parallel state has started.

Additional fields

  • parentState: An object of type StateData containing data associated with the Parallel state to which this branch belongs to.
  • input: Input value passed to the branch.

Example

{
    type: 'ParallelBranchStarted',
    timestamp: 1234567890123,
    parentState: {
        name: 'ParallelState',
        type: 'Parallel',
        input: { bucketName: 'videos-bucket', key: 'training/first-day.mp4' }
    },
    input: { bucketName: 'videos-bucket', key: 'training/first-day.mp4' }
}

ParallelBranchSucceeded event

The ParallelBranchSucceeded event is produced when a branch in a Parallel state ends successfully.

Additional fields

  • parentState: An object of type StateData containing data associated with the Parallel state to which this branch belongs to.
  • output: Output value produced by the branch.

Example

{
    type: 'ParallelBranchSucceeded',
    timestamp: 1234567890123,
    parentState: {
        name: 'ParallelState',
        type: 'Parallel',
        input: { bucketName: 'videos-bucket', key: 'training/first-day.mp4' }
    },
    output: { compressedSize: 12364311 }
}

ParallelBranchFailed event

The ParallelBranchFailed event is produced when a branch in a Parallel state encounters an error and fails.

Additional fields

  • parentState: An object of type StateData containing data associated with the Parallel state to which this branch belongs to.
  • Error: Name of the error that caused the failure.
  • Cause: This field can either be a string or an object:
    • string: Contains a description explaining why the branch failed.
    • object: Contains details that provide more information as to why the branch failed.

Example

{
    type: 'ParallelBranchFailed',
    timestamp: 1234567890123,
    parentState: {
        name: 'ParallelState',
        type: 'Parallel',
        input: { bucketName: 'videos-bucket', key: 'training/first-day.mp4' }
    },
    Error: 'CompressionError',
    Cause: 'Could not apply compression to item stored in bucket'
}

StateEntered event

The StateEntered event is produced when the execution transitions into a new state.

Additional fields

  • state: An object of type StateData containing data associated with the state that was entered.
  • index?: The index of the Map iteration in which this state is being executed. This property is only set if this state is being executed within a Map state.

Example

{
    type: 'StateEntered',
    timestamp: 1234567890123,
    state: {
        name: 'AddNumbers',
        type: 'Task',
        input: { num1: 3, num2: 2 }
    }
}

StateExited event

The StateExited event is produced when the execution transitions out of a state.

Additional fields

  • state: An object of type StateData containing data associated with the state that was exited.
  • index?: The index of the Map iteration in which this state was executed. This property is only set if this state was executed within a Map state.

Example

{
    type: 'StateExited',
    timestamp: 1234567890123,
    state: {
        name: 'AddNumbers',
        type: 'Task',
        input: { num1: 3, num2: 2 },
        output: 5
    }
}

StateFailed event

The StateFailed event is produced when the state that is currently being executed encounters an error and fails.

Additional fields

  • state: An object of type StateData containing data associated with the state that failed.
  • Error: Name of the error that caused the state to fail.
  • Cause: This field can either be a string or an object:
    • string: Contains a description explaining why the state failed.
    • object: Contains details that provide more information as to why the state failed.
  • index?: The index of the Map iteration in which this state failed. This property is only set if this state was executed within a Map state.

Example

{
    type: 'StateFailed',
    timestamp: 1234567890123,
    state: {
        name: 'ReadDataFile',
        type: 'Task',
        input: { filePath: '/home/user/data.csv' }
    },
    Error: 'ReadError',
    Cause: 'Unable to read file "data.csv". The file is not properly formatted as CSV.'
}

StateRetried event

The StateRetried event is produced when a state fails and it's retried because it matched the error specified by a retrier in the Retry field.

Additional fields

  • state: An object of type StateData containing data associated with the state that is being retried.
  • retry: An object of type RetryData containing data associated with the retry attempt.
  • index?: The index of the Map iteration in which this state is being retried. This property is only set if this state is being executed within a Map state.

Example

{
    type: 'StateRetried',
    timestamp: 1234567890123,
    state: {
        name: 'ReadDataFile',
        type: 'Task',
        input: { filePath: '/home/user/data.csv' }
    },
    retry: {
        retrier: { ErrorEquals: ['ReadError'] },
        attempt: 2
    }
}

StateCaught event

The StateCaught event is produced when a state fails and it's caught because it matched the error specified by a catcher in the Catch field.

Additional fields

  • state: An object of type StateData containing data associated with the state that was caught.
  • catch: An object of type CatchData containing data associated with the caught error.
  • index?: The index of the Map iteration in which this state was caught. This property is only set if this state was executed within a Map state.

Example

{
    type: 'StateCaught',
    timestamp: 1234567890123,
    state: {
        name: 'ReadDataFile',
        type: 'Task',
        input: { filePath: '/home/user/data.csv' }
    },
    catch: {
        catcher: {
            ErrorEquals: ['ReadError'],
            Next: 'RecoveryState'
        }
    }
}

Helper data types

StateData

interface StateData {
  name: string;
  type: 'Task' | 'Parallel' | 'Map' | 'Pass' | 'Wait' | 'Choice' | 'Succeed' | 'Fail';
  input: any;
  output?: any;
}
  • name: Name of the state.
  • type: Type of the state.
  • input: The input passed to the state.
  • output: The output produced by the state. Only set when event is of type StateExited.

RetryData

interface RetryData {
  retrier: {
    ErrorEquals: string[];
    IntervalSeconds?: number;
    MaxAttempts?: number;
    BackoffRate?: number;
    MaxDelaySeconds?: number;
    JitterStrategy?: 'NONE' | 'FULL';
  };
  attempt: number;
}
  • retrier: The retrier object that caused the state to be retried.
  • attempt: Number of current attempt (attempt: 1 being the first attempt).

CatchData

interface CatchData {
  catcher: {
    ErrorEquals: string[];
    Next: string;
    ResultPath?: string;
  };
}
  • catcher: The catcher object that caused the state to be caught.