Bacalhau Docs
GithubSlackBlogEnterprise
v1.6.x
  • Documentation
  • Use Cases
  • CLI & API
  • References
  • Community
v1.6.x
  • Welcome
  • Getting Started
    • How Bacalhau Works
    • Getting Started
      • Step 1: Install the Bacalhau CLI
      • Step 2: Running Your Own Job
      • Step 3: Checking on the Status of Your Job
    • Creating Your Own Bacalhau Network
      • Setting Up a Cluster on Amazon Web Services (AWS) with Terraform 🚀
      • Setting Up a Cluster on Google Cloud Platform (GCP) With Terraform 🚀
      • Setting Up a Cluster on Azure with Terraform 🚀
    • Hardware Setup
    • Container Onboarding
      • Docker Workloads
      • WebAssembly (Wasm) Workloads
  • Setting Up
    • Running Nodes
      • Node Onboarding
      • GPU Installation
      • Job selection policy
      • Access Management
      • Node persistence
      • Configuring Your Input Sources
      • 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
    • Networking Instructions
      • Accessing the Internet from Jobs
      • Utilizing NATS.io within Bacalhau
    • GPU Workloads Setup
    • Automatic Update Checking
    • Marketplace Deployments
      • Google Cloud Marketplace
    • Inter-Nodes TLS
  • Guides
    • Configuration Management
    • Write a config.yaml
    • Write a SpecConfig
    • Using Labels and Constraints
  • Examples
    • Table of Contents for Bacalhau 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
      • Bacalhau and BigQuery
    • Data Ingestion
      • Copy Data from URL to Public Storage
      • Pinning Data
      • Running a Job over S3 data
    • 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
    • Systems Engineering
      • Ad-hoc log query using DuckDB
  • 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 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
  • Overview
  • Basic Structure
  • Field Reference
  • Task Configuration
  • Validation and Testing
  • Troubleshooting Guide

Was this helpful?

Export as PDF
  1. Guides

Write a SpecConfig

Overview

A job specification defines how Bacalhau should execute your workload. This guide provides a complete reference of all supported options, configurations, and their valid values.

Basic Structure

A job specification is a JSON document with the following structure:

{
  "Name": "my-job",
  "Type": "batch",
  "Count": 1,
  "Tasks": [{
    "Name": "main",
    "Engine": {
      "Type": "docker",
      "Params": {
        "Image": "ubuntu:latest"
      }
    },
    "Resources": {
      "CPU": "1",
      "Memory": "1GB"
    }
  }]
}

Field Reference

Job Level Fields

Field
Type
Required
Default
Valid Values

Name

string

Yes

-

Alphanumeric with - and _

Type

string

Yes

batch

batch, service, daemon, ops

Count

integer

No

1

1 or greater

Priority

integer

No

0

0-100

Namespace

string

No

default

Valid DNS label

Labels

object

No

{}

Key-value string pairs

Tasks

array

Yes

-

Array of task objects

Types

These are the types of jobs:

  • batch: Run once and complete

  • service: Run continuously with specified replica count

  • daemon: Run continuously on all matching nodes

  • ops: Run once on all matching nodes

Task Configuration

Tasks define the actual work to be performed. Each task requires:

  1. Engine configuration (how to run)

  2. Resource requirements (what it needs)

  3. Data handling (inputs/outputs)

Inside tasks, there are a number of fields.

Task Level Fields

Field
Type
Required
Default
Valid Values

Name

string

Yes

-

Alphanumeric with - and _

Engine

object

Yes

-

Engine configuration

Resources

object

Yes

-

Resource requirements

InputSources

array

No

[]

Array of input sources

ResultPaths

array

No

[]

Array of result paths

Network

object

No

{"Type": "none"}

Network configuration

Timeouts

object

No

-

Timeout settings

Env

object

No

{}

Key-value string pairs

Meta

object

No

{}

Key-value string pairs

Additionally, there are sub-fields to fill in.

Engine Types

  • docker: Docker container execution

  • wasm: WebAssembly module execution

Engine Configuration

Docker Engine Parameters

Parameter
Type
Required
Description

Image

string

Yes

Docker image name

Entrypoint

array

No

Container entrypoint

Parameters

array

No

Command parameters

WorkingDirectory

string

No

Working directory

EnvironmentVariables

object

No

Environment variables

Ports

array

No

Port mappings

Example:

"Engine": {
  "Type": "docker",
  "Params": {
    "Image": "python:3.9-slim",
    "Entrypoint": ["python"],
    "Parameters": ["-c", "print('hello')"],
    "WorkingDirectory": "/app",
    "EnvironmentVariables": {
      "PYTHONUNBUFFERED": "1"
    }
  }
}

Common Edge Cases:

  • Images without default entrypoints require explicit entrypoint

  • Environment variables with spaces or special characters need proper escaping

  • Working directory must exist in container

  • Large images may exceed node storage limits

WASM Engine Parameters

Parameter
Type
Required
Description

EntryModule

string

Yes

WASM module path

EntryPoint

string

Yes

Exported function name

Parameters

array

No

Function arguments

EnvironmentVariables

object

No

Environment variables

Example:

"Engine": {
  "Type": "wasm",
  "Params": {
    "EntryModule": "app.wasm",
    "EntryPoint": "_start",
    "Parameters": ["--verbose"],
    "EnvironmentVariables": {
      "MEMORY_LIMIT": "512MB"
    }
  }
}

Storage Types

  • ipfs: IPFS content (you must provide your own IPFS endpoint)

  • s3: Amazon S3 storage

  • local: Local filesystem

  • urlDownload: HTTP/HTTPS URLs

  • s3PreSigned: Pre-signed S3 URLs

Network Types

  • none: No network access (default)

  • http: Limited HTTP/HTTPS access

  • full: Unrestricted network access

Publisher Types

  • ipfs: Publish to IPFS

  • s3: Upload to S3

  • local: Store locally

  • noop: Discard results

Resource Requirements

Resource Fields

Field
Type
Required
Format
Range

CPU

string

Yes

Decimal

0.1 to node max

Memory

string

Yes

Size + Unit

1MB to node max

Disk

string

Yes

Size + Unit

10MB to node max

GPU

string

No

Integer

0 to node max

Example:

"Resources": {
  "CPU": "1.5",
  "Memory": "2GB",
  "Disk": "10GB",
  "GPU": "1"
}

Data Handling

Input Source Fields

Field
Type
Required
Description

Source.Type

string

Yes

One of: ipfs, s3, local, urlDownload, s3PreSigned, inline

Source.Params

object

Yes

Source-specific parameters

Target

string

Yes

Absolute mount path

Alias

string

No

Friendly identifier

Source Type Parameters

IPFS:

{
  "CID": "string",
  "Gateway": "string"
}

S3:

{
  "Bucket": "string",
  "Key": "string",
  "Region": "string",
  "Endpoint": "string",
  "AccessKeyID": "string",
  "SecretAccessKey": "string"
}

URL:

{
  "URL": "string",
  "Headers": {
    "string": "string"
  }
}

Inline:

{
  "Content": "string"
}

Example:

"InputSources": [
  {
    "Source": {
      "Type": "ipfs",
      "Params": {
        "CID": "QmHash..."
      }
    },
    "Target": "/inputs/data",
    "Alias": "dataset"
  }
]

This can accept multiple sources - for example:

"InputSources": [
  {
    "Source": {"Type": "ipfs", ...},
    "Target": "/inputs/data1"
  },
  {
    "Source": {"Type": "s3", ...},
    "Target": "/inputs/data2"
  }
]

Network Configuration

"Network": {
  "Type": "http",
  "Domains": ["api.example.com"],
  "EnableIPv6": true,
  "DNS": ["8.8.8.8"],
  "Policies": {
    "Egress": {
      "Ports": ["80", "443"]
    }
  }
}

Timeout Configuration

"Timeouts": {
  "ExecutionTimeout": 3600,
  "QueueTimeout": 300,
  "TotalTimeout": 4000
}

Validation and Testing

Pre-Submission Validation

You can test your job schema by running the validatecommand. E.g.

bacalhau validate job.json

Test Runs

Bacalhau also supports --dry-runfor testing, though this is only done locally. It does not test against the network.

bacalhau run --dry-run job.json

Troubleshooting Guide

Common Error Messages

  1. Resource Errors

    Error: insufficient resources: CPU request exceeds node capacity

    Solution: Check node capabilities and adjust requests

  2. Network Errors

    Error: network access denied: domain not in allowlist

    Solution: Verify network policy and domain lists

  3. Timeout Errors

    Error: job exceeded ExecutionTimeout

    Solution: Adjust timeouts or optimize job

PreviousWrite a config.yamlNextUsing Labels and Constraints

Was this helpful?