Skip to main content

Pools

A pool defines a configuration for automatically launching workers in a workspace. Instead of manually starting workers, you can configure a pool and the server will launch and manage workers on your behalf.

Configuring a pool

Pools are configured using the CLI. Use --type to specify the launcher type and --set to configure launcher-specific fields:

coflux pools create mypool --type process \
--set directory=/path/to/project \
--modules myapp.workflows myapp.tasks

Launcher types

Each pool has a launcher that determines how workers are started. The server must be configured to allow the relevant launcher type (COFLUX_LAUNCHER_TYPES).

Docker launcher

Launches workers as Docker containers:

coflux pools create mypool --type docker \
--set image=myorg/myapp:latest \
--set dockerHost=tcp://docker:2375 \
--modules myapp.workflows
FieldDescription
imageDocker image to run
dockerHostDocker host (default: local socket)

Process launcher

Launches workers as local processes:

coflux pools create mypool --type process \
--set directory=/path/to/project \
--modules myapp.workflows
FieldDescription
directoryWorking directory for the worker process

Kubernetes launcher

note

The Kubernetes launcher is experimental — the API may change based on feedback.

Launches workers as Kubernetes Jobs:

coflux pools create mypool --type kubernetes \
--set image=myorg/myapp:latest \
--set namespace=coflux-workers \
--set serverHost=coflux-server.coflux.svc:7777 \
--modules myapp.workflows

When the Coflux server runs inside Kubernetes, it automatically uses in-cluster authentication. For external servers, provide the API server URL and a bearer token:

coflux pools create mypool --type kubernetes \
--set image=myorg/myapp:latest \
--set apiServer=https://my-cluster.example.com:6443 \
--set token="$(cat /path/to/token)" \
--set serverHost=coflux.example.com:7777 \
--modules myapp.workflows

Note that the token is stored in the orchestration database.

FieldDescription
imageContainer image to run
namespaceKubernetes namespace (default: default)
apiServerKubernetes API server URL (default: in-cluster)
tokenBearer token for API authentication
caCertCA certificate for TLS verification
insecureSkip TLS verification
serviceAccountService account for launched pods
imagePullPolicyImage pull policy (Always, IfNotPresent, Never)
imagePullSecretsImage pull secret names
nodeSelectorNode selection labels
tolerationsPod tolerations
hostAliasesHost aliases for pods
resourcesCPU/memory/GPU requests and limits
labelsCustom pod labels
annotationsCustom pod annotations
activeDeadlineSecondsJob timeout in seconds
volumesKubernetes volume definitions
volumeMountsVolume mounts in container

Common fields

These fields apply to all launcher types:

Field / FlagDescription
--modules, -mModules to host (can be specified multiple times)
--providesFeatures that workers provide (e.g., gpu:A100)
--acceptsTags that executions must have to be assigned to this pool
serverHostServer host override for launched workers
serverSecureUse TLS for server connection
adapterAdapter command
concurrencyMaximum concurrent executions per worker
envEnvironment variables (e.g., --set env.KEY=VALUE)

Managing pools

# List pools in a workspace
coflux pools list

# Get pool configuration
coflux pools get mypool

# Update pool configuration
coflux pools update mypool --set image=myorg/myapp:v2

# View launched workers
coflux pools launches mypool

# Watch launches in real-time
coflux pools launches mypool --watch

# Disable a pool (drains workers, stops new assignments)
coflux pools disable mypool

# Re-enable a disabled pool
coflux pools enable mypool

# Delete a pool
coflux pools delete mypool

Exporting and importing

Pool configurations can be exported to TOML and imported back, making it easy to replicate setups across environments or manage configurations declaratively:

# Export all pools
coflux pools export -o pools.toml

# Export specific pools
coflux pools export --only mypool --only gpu-pool -o pools.toml

# Import pools
coflux pools import pools.toml

Provides, accepts, and requires

Workers can declare features they provide, and targets can require specific features. This allows routing executions to appropriate workers — for example, GPU-intensive tasks to GPU-equipped workers.

On the worker side, configure provides on the pool:

coflux pools create gpu-pool --type docker \
--set image=myorg/gpu-worker:latest \
--provides gpu:A100 \
--modules myapp.workflows

On the task side, specify requires in the decorator:

@cf.task(requires={"gpu": "A100"})
def train_model(data):
...

The requires parameter accepts a dictionary where keys are feature names and values can be a specific value ("A100"), a list of acceptable values (["A100", "H100"]), or True to require the feature with any value.

Setting requires on a @workflow applies to the entire run — child tasks are automatically routed to matching workers unless explicitly overridden per-task.

Accepts tags

Pools can also declare what they accept. When a pool defines accepts tags, only executions whose requires tags match will be assigned to it. This prevents general work from being scheduled to specialised workers:

coflux pools create gpu-pool --type docker \
--set image=myorg/gpu-worker:latest \
--accepts gpu:A100,H100 \
--modules myapp.workflows

In this example, only tasks that require gpu:A100 or gpu:H100 will be assigned to gpu-pool. Tasks without a matching requires tag will not be sent to this pool, even if there are idle workers.