Skip to content

Using hooks to customize job execution

You use hooks to override the default behavior of a job or of all jobs in a workflow, or to customize the behavior of functions.

Overview

About functions hooks

You can use hooks to define a set of actions to customize the behavior of functions.

Typically, you use function hooks to:

Example of defining hooks for function a

Function hooks Function hooks

When more than one hook is defined for the same event, the orchestrator order them as follows:

  1. before hooks defined in the workflow (in order of appearance)
  2. before hooks defined by the function handler (in order of appearance)
  3. Steps from the event
  4. after hooks defined by the function handler (in reverse order)
  5. after hooks defined in the workflow (in reverse order)

For more information on setting function hooks, see “Defining function hooks.”

About job hooks

Typically, you use jobs hooks to:

Job hooks override the default behavior at job setup and teardown time. That allows you to specify a specific workspace for the job to run on, or to keep this workspace if the job fails, or if some condition occurs.

Example of defining job hooks

Job hooks Job hooks

When more than one hook is defined for the same event, the orchestrator order them as follows:

  1. before hooks defined in the workflow (in order of appearance)
  2. before hooks defined by the job handler (in order of apperance)
  3. Steps from the event
  4. after hooks defined by the job handler (in reverse order)
  5. after hooks defined in the workflow (in reverse order)

For more information on setting job hooks, see “Defining job hooks.”