Class: Job

Job(name, image, event)

A Brigade job. Instances of Job represent containers that your Brigade script can run using the Job#run method. The Job#primaryContainer, initialized from the constructor image argument, determines how long the job runs and whether it is considered successful. By default, the container is simply executed (via its default entry point). Set the Job#primaryContainer#command property to run a specific command in the container instead. Other containers, specified via Job#sidecarContainers, are automatically terminated a short time after the primary container completes. Job also provides static methods for building up runnable elements out of more basic ones. For example, to compose a set of workloads into a sequence, you can use the Job.sequence method.

Constructor

new Job(name, image, event)

Constructs a new Job.
Parameters:
Name Type Description
name The name of the job
image The OCI image reference for the primary container
event The event that triggered the job
Source:

Members

fallible

Specifies whether the job is permitted to fail WITHOUT causing the worker process to fail.
Source:

host

Specifies requirements for the job execution environment.
Source:

sidecarContainers

Specifies sidecar containers to run alongside the primary container.
Source:

timeoutSeconds

The duration, in seconds, after which Brigade should automatically terminate and fail the job if it has not completed. The default is 15 minutes.
Source:

Methods

(static) concurrent(…runnables)

Specifies a Runnable composed of sub-Runnables (such as jobs or sequential groups) running concurrently. When run, all Runnables are started simultaneously (subject to scheduling constraints). The concurrent group completes when all Runnables have completed.
Parameters:
Name Type Attributes Description
runnables <repeatable>
The work items to be run in parallel
Source:

(static) container(name, image, event)

Specifies a Runnable that executes one or more containers. The image argument specifies the primary container, which determines how long the job runs and whether it is considered successful. By default, the primary container is simply executed (via its default entry point). Set the Job#primaryContainer#command property to run a specific command in the container instead. Other containers, specified via Job#sidecarContainers, are automatically terminated after the primary container completes. (Note: This is equivalent to `new Job(...)`. It is provided so that script authors have the option of a consistent style for creating and composing jobs and groups.)
Parameters:
Name Type Description
name The name of the job
image The OCI image reference for the primary container
event The event that triggered the job
Source:

(static) sequence(…runnables)

Specifies a Runnable composed of sub-Runnables (such as jobs or concurrent groups) running one after another. A new Runnable is started only when the previous one completes. The sequence completes when the last Runnable has completed (or when any Runnable fails).
Parameters:
Name Type Attributes Description
runnables <repeatable>
The work items to be run in sequence
Source:

logs()

Gets the job logs. If the job has multiple containers, this aggregates the logs from them all. NOTE: In a local test environment, this function returns a dummy log. In the real Brigade runtime environment, it returns the actual container logs.
Source:

run()

Runs the job. When you run the job, Brigade runs all the containers, primary and sidecar. When the primary container exits, the job ends. If sidecars are still running at this point, Brigade terminates them after a short delay. NOTE: In a local test environment, this function does not run the containers, but instead automatically succeeds. In the real Brigade runtime environment, the containers run as described.
Source:
Returns:
A Promise which completes when the primary container completes. If the primary container succeeded (exited with code 0), the Promise resolves; if the primary container failed (exited with nonzero code) or timed out, the Promise rejects. Sidecars do not affect success or failure of the job.