Job Run
Description
The bacalhau job run
command facilitates the initiation of a job from a file or directly from the standard input (stdin). The command supports both JSON and YAML data formats. This command is particularly useful for quickly executing a job without the need for manual configurations.
Usage
Flags
--dry-run
:Description: With this flag, the job will not be submitted. Instead, it will display what would have been submitted, providing a way to preview before actual submission.
-f
,--follow
:Description: If provided, the command will continuously display the output from the job as it runs.
--id-only
:Description: On successful job submission, only the Job ID will be printed.
--no-template
:Disable the templating feature. When this flag is set, the job spec will be used as-is, without any placeholder replacements
--node-details
:Description: Displays details of all nodes. Note that this flag is overridden if
--id-only
is provided.
--show-warnings
:Description: Shows any warnings that occur during the job submission.
-E
,--template-envs
:Specify a regular expression pattern for selecting environment variables to be included as template variables in the job spec. e.g.
--template-envs ".*"
will include all environment variables.
-V
,--template-vars
:Replace a placeholder in the job spec with a value. e.g.
--template-vars foo=bar
--wait
:Description: Waits for the job to finish execution. To set this to false, use --wait=false
Default:
true
--wait-timeout-secs int
:Description: If
--wait
is provided, this flag sets the maximum time (in seconds) the command will wait for the job to finish before it terminates.Default:
600
seconds
-h
,--help
:Description: Displays help information for the
run
command.
Global Flags
--api-host string
:Description: Specifies the host used for RESTful communication between the client and server. The flag is disregarded if
BACALHAU_API_HOST
environment variable is set.Default:
bootstrap.production.bacalhau.org
--api-port int
:Description: Determines the port for REST communication. If
BACALHAU_API_PORT
environment variable is set, this flag will be ignored.Default:
1234
--log-mode logging-mode
:Description: Selects the desired log format. Options include:
default
,station
,json
,combined
, andevent
.Default:
default
--repo string
:Description: Defines the path to the bacalhau repository.
Default:
$HOME/.bacalhau
Examples
Sample Job (job.yaml
)
A sample job used in the following examples is provided below:
This configuration describes a batch job that runs a Docker task. It utilizes the ubuntu:latest
image and executes the command echo Hello Bacalhau!
.
Running a Job using a YAML Configuration:
To run a job with a configuration provided in a
job.yaml
file:Command:
Expected Output:
Running a Job and Following its Logs:
Command:
Expected Output:
Running a Job Without Waiting:
Command:
Expected Output:
Fetching Only the Job ID Upon Submission:
Command:
Expected Output:
Fetching Only the Job ID and Wait for Completion:
Command:
Expected Output:
Running a Job with Node Details:
Command:
Expected Output:
Rerunning a previously submitting job:
Command:
Expected Output:
Templating
bacalhau job run
providing users with the ability to dynamically inject variables into their job specifications. This feature is particularly useful when running multiple jobs with varying parameters such as S3 buckets, prefixes, and time ranges without the need to edit each job specification file manually. You can find more information about templating here.