Bacalhau Docs
GithubSlackBlogEnterprise
v1.5.x
  • Documentation
  • Use Cases
  • CLI & API
  • References
  • Community
v1.5.x
  • Welcome
  • Getting Started
    • How Bacalhau Works
    • Installation
    • Create Network
    • Hardware Setup
    • Container Onboarding
      • Docker Workloads
      • WebAssembly (Wasm) Workloads
  • Setting Up
    • Running Nodes
      • Node Onboarding
      • GPU Installation
      • Job selection policy
      • Access Management
      • Node persistence
      • Connect Storage
      • Configuring Transport Level Security
      • Limits and Timeouts
      • Test Network Locally
      • Bacalhau WebUI
      • Private IPFS Network Setup
    • Workload Onboarding
      • Container
        • Docker Workload Onboarding
        • WebAssembly (Wasm) Workloads
        • Bacalhau Docker Image
        • How To Work With Custom Containers in Bacalhau
      • Python
        • Building and Running Custom Python Container
        • Running Pandas on Bacalhau
        • Running a Python Script
        • Running Jupyter Notebooks on Bacalhau
        • Scripting Bacalhau with Python
      • R (language)
        • Building and Running your Custom R Containers on Bacalhau
        • Running a Simple R Script on Bacalhau
      • Run CUDA programs on Bacalhau
      • Running a Prolog Script
      • Reading Data from Multiple S3 Buckets using Bacalhau
      • Running Rust programs as WebAssembly (WASM)
      • Generate Synthetic Data using Sparkov Data Generation technique
    • Data Ingestion
      • Copy Data from URL to Public Storage
      • Pinning Data
      • Running a Job over S3 data
    • Networking Instructions
      • Accessing the Internet from Jobs
      • Utilizing NATS.io within Bacalhau
    • GPU Workloads Setup
    • Automatic Update Checking
    • Marketplace Deployments
      • Google Cloud Marketplace
  • Guides
    • (Updated) Configuration Management
    • Write a config.yaml
    • Write a SpecConfig
  • Examples
    • Data Engineering
      • Using Bacalhau with DuckDB
      • Ethereum Blockchain Analysis with Ethereum-ETL and Bacalhau
      • Convert CSV To Parquet Or Avro
      • Simple Image Processing
      • Oceanography - Data Conversion
      • Video Processing
    • Model Inference
      • EasyOCR (Optical Character Recognition) on Bacalhau
      • Running Inference on Dolly 2.0 Model with Hugging Face
      • Speech Recognition using Whisper
      • Stable Diffusion on a GPU
      • Stable Diffusion on a CPU
      • Object Detection with YOLOv5 on Bacalhau
      • Generate Realistic Images using StyleGAN3 and Bacalhau
      • Stable Diffusion Checkpoint Inference
      • Running Inference on a Model stored on S3
    • Model Training
      • Training Pytorch Model with Bacalhau
      • Training Tensorflow Model
      • Stable Diffusion Dreambooth (Finetuning)
    • Molecular Dynamics
      • Running BIDS Apps on Bacalhau
      • Coresets On Bacalhau
      • Genomics Data Generation
      • Gromacs for Analysis
      • Molecular Simulation with OpenMM and Bacalhau
  • References
    • Jobs Guide
      • Job Specification
        • Job Types
        • Task Specification
          • Engines
            • Docker Engine Specification
            • WebAssembly (WASM) Engine Specification
          • Publishers
            • IPFS Publisher Specification
            • Local Publisher Specification
            • S3 Publisher Specification
          • Sources
            • IPFS Source Specification
            • Local Source Specification
            • S3 Source Specification
            • URL Source Specification
          • Network Specification
          • Input Source Specification
          • Resources Specification
          • ResultPath Specification
        • Constraint Specification
        • Labels Specification
        • Meta Specification
      • Job Templates
      • Queuing & Timeouts
        • Job Queuing
        • Timeouts Specification
      • Job Results
        • State
    • CLI Guide
      • Single CLI commands
        • Agent
          • Agent Overview
          • Agent Alive
          • Agent Node
          • Agent Version
        • Config
          • Config Overview
          • Config Auto-Resources
          • Config Default
          • Config List
          • Config Set
        • Job
          • Job Overview
          • Job Describe
          • Job Exec
          • Job Executions
          • Job History
          • Job List
          • Job Logs
          • Job Run
          • Job Stop
        • Node
          • Node Overview
          • Node Approve
          • Node Delete
          • Node List
          • Node Describe
          • Node Reject
      • Command Migration
    • API Guide
      • Bacalhau API overview
      • Best Practices
      • Agent Endpoint
      • Orchestrator Endpoint
      • Migration API
    • Node Management
    • Authentication & Authorization
    • Database Integration
    • Debugging
      • Debugging Failed Jobs
      • Debugging Locally
    • Running Locally In Devstack
    • Setting up Dev Environment
  • Help & FAQ
    • Bacalhau FAQs
    • Glossary
    • Release Notes
      • v1.5.0 Release Notes
      • v1.4.0 Release Notes
  • Integrations
    • Apache Airflow Provider for Bacalhau
    • Lilypad
    • Bacalhau Python SDK
    • Observability for WebAssembly Workloads
  • Community
    • Social Media
    • Style Guide
    • Ways to Contribute
Powered by GitBook
LogoLogo

Use Cases

  • Distributed ETL
  • Edge ML
  • Distributed Data Warehousing
  • Fleet Management

About Us

  • Who we are
  • What we value

News & Blog

  • Blog

Get Support

  • Request Enterprise Solutions

Expanso (2025). All Rights Reserved.

On this page
  • Description
  • Usage
  • Flags
  • Global Flags
  • Examples
  • Templating

Was this helpful?

Export as PDF
  1. References
  2. CLI Guide
  3. Single CLI commands
  4. Job

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

bacalhau job run [flags]

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, and event.

    • 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:

cat job.yaml
name: A Simple Docker Job
type: batch
count: 1
tasks:
  - name: My main task
    engine:
      type: docker
      params:
        Image: ubuntu:latest
        Entrypoint:
          - /bin/bash
        Parameters:
          - -c
          - echo Hello Bacalhau!

This configuration describes a batch job that runs a Docker task. It utilizes the ubuntu:latest image and executes the command echo Hello Bacalhau!.

  1. Running a Job using a YAML Configuration:

    To run a job with a configuration provided in a job.yaml file:

    Command:

    bacalhau job run job.yaml

    Expected Output:

    Job successfully submitted. Job ID: j-2d0f513a-9eb1-49c2-8bc8-246c6fb41520
    Checking job status... (Enter Ctrl+C to exit at any time, your job will continue running):
    
     Communicating with the network  ................  done ✅  0.1s
        Creating job for submission  ................  done ✅  0.6s
    
    To get more details about the run, execute:
     bacalhau job describe j-2d0f513a-9eb1-49c2-8bc8-246c6fb41520
    
    To get more details about the run executions, execute:
     bacalhau job executions j-2d0f513a-9eb1-49c2-8bc8-246c6fb41520
  2. Running a Job and Following its Logs:

    Command:

    bacalhau job run job.yaml --follow

    Expected Output:

    Job successfully submitted. Job ID: j-b89df816-7564-4f04-b270-e6cda89eda72
    Waiting for logs... (Enter Ctrl+C to exit at any time, your job will continue running):
    
    Hello Bacalhau!
  3. Running a Job Without Waiting:

    Command:

    bacalhau job run job.yaml --wait=false

    Expected Output:

    j-3fd396b3-e92e-42ca-bd87-0dc9eb15e6f9
  4. Fetching Only the Job ID Upon Submission:

    Command:

    bacalhau job run job.yaml --id-only

    Expected Output:

    j-5976ffb6-3465-4fec-8b3b-2c822cbaf417
  5. Fetching Only the Job ID and Wait for Completion:

    Command:

    bacalhau job run job.yaml --id-only --wait

    Expected Output:

    j-293f1302-3298-4aca-b06d-33fd1e3f9d2c
  6. Running a Job with Node Details:

    Command:

    bacalhau job run job.yaml --node-details

    Expected Output:

    Job successfully submitted. Job ID: j-05e65dd3-4e9e-4e20-a104-3c91ba934435
    Checking job status... (Enter Ctrl+C to exit at any time, your job will continue running):
    
     Communicating with the network  ................  done ✅  0.1s
        Creating job for submission  ................  done ✅  0.6s
    
    Job Results By Node:
    • Node QmVXwmdZ:
     Hello Bacalhau!
    
    To get more details about the run, execute:
     bacalhau job describe j-05e65dd3-4e9e-4e20-a104-3c91ba934435
    
    To get more details about the run executions, execute:
     bacalhau job executions j-05e65dd3-4e9e-4e20-a104-3c91ba934435
  7. Rerunning a previously submitting job:

    Command:

    bacalhau job describe j-05e65dd3-4e9e-4e20-a104-3c91ba934435 | bacalhau job run

    Expected Output:

    Reading from /dev/stdin; send Ctrl-d to stop.Job successfully submitted. Job ID: j-d8625929-83f4-411a-b9aa-7bcfecb27a8b
    Checking job status... (Enter Ctrl+C to exit at any time, your job will continue running):
    
     Communicating with the network  ................  done ✅  0.1s
        Creating job for submission  ................  done ✅  0.6s
    
    To get more details about the run, execute:
     bacalhau job describe j-d8625929-83f4-411a-b9aa-7bcfecb27a8b
    
    To get more details about the run executions, execute:
     bacalhau job executions j-d8625929-83f4-411a-b9aa-7bcfecb27a8b

Templating

PreviousJob LogsNextJob Stop

Was this helpful?

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