Skip to content

Jobs and resources

conceptconfiguration-jobs-and-resources

Set how much compute the jobs of the Blocks get, and how they wait for it.

The BackendBackend — The server program of Platforma. It keeps the projects, runs the Blocks and starts jobs. Glossary runs each step of a BlockBlock — A small application for one step of an analysis, for example the import of reads or clustering. It can combine several tools. Glossary as a jobjob — One run of a tool on data. The Backend starts jobs on the server where it runs, or in a Kubernetes cluster. Glossary, and gives it the CPU and the memory that the Block asks for. You do not size each job: you set the rules once, and they decide how fast the analyses run and what they cost. The settings:

For what Platforma expects from the nodes and the queues, see Nodes, job queues and GPU. For what the settings mean for the bill, see Size and cost.

Queues

The Backend puts each job into one of four queues: ui-tasks for the short tasks that the Desktop App waits for, and heavy, medium and light for the computations of the Blocks.

The Helm chart sends the four queues to two KueueKueue — A Kubernetes add-on that holds jobs in a queue until the cluster has free CPU, memory and GPU for them. Glossary ClusterQueues: ui-tasks to the UI queue, and heavy, medium and light to the batch queue with the priorities high, normal and low. For the rules of the queues, see Queues and priorities.

Setting Terraform modulesTerraform modules — The Terraform code that MiLaboratories provides to install Platforma. The cloud-specific Terraform modules make the cluster and its cloud parts in AWS or Google Cloud; the cloud-agnostic Terraform modules install Platforma into the cluster. Glossary Helm chart Default
The UI queue can use free quota of the batch queue components.kueue.ui_borrows_batch_quota of platforma-tf-services-cluster — (the cluster has the queues) true
Queue statistics in the Desktop AppDesktop App — The program that each user installs on their own computer to work with Platforma. It is a client of the Backend. Glossary components.queue_statistics.enabled of platforma-tf-services-cluster jobs.queueStatistics true
Names of the queues and the priorities components.kueue.cluster_queues, components.kueue.priority_classes jobs.clusterQueues see Default names
Inputs of platforma-tf-services-cluster
components = {
kueue = { ui_borrows_batch_quota = false }
queue_statistics = { enabled = false }
}
values.yaml
jobs:
queueStatistics: false

With ui_borrows_batch_quota = false, UI tasks never run on the quota of the batch queue: they wait for the UI nodes, also when batch nodes are free.

Keep the queue statistics on (the default): the Desktop App then shows users how many jobs run and wait in the cluster. So users see when a job only waits in the queue, and they do not report a problem that does not exist. Turn them off only when the Backend cannot get read rights on its two ClusterQueues: then the Backend does not read the ClusterQueues, and the Desktop App does not show the load of the queues.

Node pools and quotas

This section is for a KubernetesKubernetes — A system that runs programs on a group of machines (a cluster). Platforma can run in a Kubernetes cluster. Glossary cluster. For Single Server modeSingle Server mode — The mode in which the Backend and all its jobs run on one Linux machine, the server, with no Kubernetes cluster. Glossary, see Jobs in Single Server mode.

Terraform modules, AWS or Google Cloud. In the input node_pools of platforma-tf-cloud-base, each job pool (ui, batch and the optional gpu) has a list of node groups and an optional quota:

Key of a node group What it sets Default
name The name, also the value of the label platforma.bio/node-group. Lowercase letters, digits and -, at most 23 characters, unique in all pools, not system or backend —
instance_type (AWS), machine_type (Google Cloud) The machine of each node —
min_size Nodes that run all the time 0
max_size The most nodes of the group, at least 1. Required —
boot_disk_size_gib The boot disk of each node 100 for ui, 200 for batch and gpu
allocatable What one job can use on a node (cpu, memory_gib) computed by the module
zones (Google Cloud) The zones of the group the zones of the cluster

The ui and batch pools need at least one node group each. Each job pool, also gpu when it has node groups, needs node groups of 2 or more machine types, so that small jobs do not start large nodes. Otherwise the module stops the plan with an error. For the default node groups and their cost, see How to limit the cost.

quota (cpu, memory_gib, and gpus for the gpu pool) caps what the queue of the pool admits at the same time. By default, it is the sum of max_size × allocatable of the node groups of the pool. Set a quota that is not higher than this sum: a higher quota lets Kueue admit jobs that no node can take.

cloud.tfvars
node_pools = {
batch = {
node_groups = [
{ name = "batch-4c-16g", instance_type = "m7i.xlarge", max_size = 8 },
{ name = "batch-32c-256g", instance_type = "r7i.8xlarge", max_size = 4 },
]
}
}

Terraform modules, own cluster. In cluster_config of platforma-tf-services-cluster, each pool (ui, batch, optional gpu) has its node_selector, its tolerations, its node_groups (name, max_size, allocatable) and an optional quota. Set autoscaling.enabled:

  • true when a cluster autoscaler adds the job nodes: the quota is max_size × allocatable, or a lower value that you set;
  • false for a fixed set of nodes: set the quota and the allocatable of each node group, or set none of them, and the module reads the ready nodes of the pool.
cluster_config (part)
node_pools = {
# ... the pools ui and backend
batch = {
node_selector = { "platforma.bio/pool" = "batch" }
tolerations = [{ key = "platforma.bio/pool", operator = "Equal", value = "batch", effect = "NoSchedule" }]
node_groups = [
{ name = "batch-4c-16g", max_size = 8, allocatable = { cpu = 3, memory_gib = 13 } },
{ name = "batch-32c-256g", max_size = 4, allocatable = { cpu = 31, memory_gib = 240 } },
]
quota = { cpu = 120, memory_gib = 960 }
}
}
autoscaling = { enabled = true, provisioning_request = {} }

Helm chart. The team that runs the cluster makes the pools, the Kueue queues and their quotas. The chart needs only the largest job.

A change. A larger max_size lets more jobs run at the same time: the analyses end sooner, and the cost of the peak hour is higher. A lower quota makes jobs wait longer. The vCPU quota of the cloud account must allow the maximum sizes. A new largest node group changes the largest job.

Largest job

When a Block asks for more than the largest job, the Backend makes the request smaller, down to this limit, and writes a warning to its log. The job then starts, but it can run out of memory.

The limit is the allocatable CPUs (a whole number) and memory of one batch node, both from the same node group. For why, see Job limits.

  • Terraform modules, AWS or Google Cloud: the modules compute it from the batch node group with the most memory, and for GPU jobs from the GPU node group with the most VRAM. To change it, change the node groups.

  • Terraform modules, own cluster: the module computes it from the allocatable of the node groups in cluster_config (see Node pools and quotas). In this example, the largest job is 31 CPUs and 240 GiB:

    cluster_config (part)
    node_pools = {
    # ... ui and the other keys of batch
    batch = {
    node_groups = [
    { name = "batch-4c-16g", max_size = 8, allocatable = { cpu = 3, memory_gib = 13 } },
    { name = "batch-32c-256g", max_size = 4, allocatable = { cpu = 31, memory_gib = 240 } },
    ]
    }
    }
  • Helm chart: jobs.maxRequest is required and does not have a default. Set cpu (a whole number) and memory, and for GPU jobs gpu: { vram, cpu, memory }.

values.yaml
jobs:
maxRequest:
cpu: 15
memory: 55Gi

Scaling

This section is for a Kubernetes cluster with an autoscaler. For how scaling changes the cost, see How jobs get computing power.

Nodes from zero. Each job node group starts at its min_size, 0 by default, and the autoscaler adds a node when a job needs it. A min_size of 1 on a small ui group removes the wait for the first UI task after a quiet time, but this node is paid all the time. On AWS, the Cluster Autoscaler of the modules removes an empty node after 10 minutes; there is no input for this time.

The autoscaler. On AWS, platforma-tf-cloud-cluster installs the Cluster Autoscaler (components.cluster_autoscaler.install, true by default; set false only when the cluster already has one). On Google Cloud, GKE has its own autoscaler.

ProvisioningRequest classes

With a ProvisioningRequest, Kueue asks the autoscaler for all nodes of a job before the job starts. For what it does, see ProvisioningRequest. Set the class for CPU jobs (cpu) and for GPU jobs (gpu):

  • in provisioning_request of platforma-tf-cloud-base (AWS and Google Cloud);
  • in cluster_config.autoscaling.provisioning_request of platforma-tf-services-cluster on an own cluster. A class there needs autoscaling.enabled = true.

The values:

  • best-effort-atomic-scale-up.autoscaling.x-k8s.io (default of the cloud-specific Terraform modulescloud-specific Terraform modules — The Terraform modules platforma-tf-cloud-base and platforma-tf-cloud-cluster. There is one pair for each cloud, AWS and Google Cloud. The roots cloud and cluster apply them. They make the network, the Kubernetes cluster, the storage, the cloud identities and the registry caches. They give the hand-off file cluster_config to the cloud-agnostic Terraform modules. Glossary for both): the autoscaler adds all nodes of the job at once, or none.
  • check-capacity.autoscaling.x-k8s.io: the autoscaler only checks that the cluster has room for the job now, and does not add nodes.
  • null: off. Kueue starts jobs by quota only.

When you set the object, a key that you do not set is off. The cloud-specific modules accept only these values. The Helm chart does not have this setting: it is a part of the Kueue queues, which the team that runs the cluster makes.

Inputs of platforma-tf-cloud-base
provisioning_request = {
cpu = "best-effort-atomic-scale-up.autoscaling.x-k8s.io"
gpu = null
}
cluster_config (part)
autoscaling = {
enabled = true
provisioning_request = { cpu = "check-capacity.autoscaling.x-k8s.io" }
}

GPU nodes

Some Blocks run a job faster on a GPU, and some of them have a CPU variant of the job too. GPU jobs are off by default.

Terraform modules, AWS or Google Cloud. Add node groups to the gpu pool of node_pools:

  • AWS: instance_type, max_size and gpu = { gpus_per_node, gpu_memory_gib } (gpu_memory_gib is the VRAM of one GPU). The instance type sets the GPU, so AWS does not use gpu.type;
  • Google Cloud: machine_type, max_size and gpu = { type, gpus_per_node, gpu_memory_gib }.

The modules give the nodes the NVIDIA image, the labels and the taints that Platforma expects, and take the largest GPU job from the group with the most VRAM. The cloud has a separate quota for GPU machines: see How to limit the cost.

cloud.tfvars (AWS)
node_pools = {
gpu = {
node_groups = [
{ name = "gpu-l4", instance_type = "g6.4xlarge", max_size = 2, gpu = { gpus_per_node = 1, gpu_memory_gib = 24 } },
{ name = "gpu-l4-8", instance_type = "g6.8xlarge", max_size = 2, gpu = { gpus_per_node = 1, gpu_memory_gib = 24 } },
]
}
}
cloud.tfvars (Google Cloud)
node_pools = {
gpu = {
node_groups = [
{ name = "gpu-l4", machine_type = "g2-standard-8", max_size = 2, gpu = { type = "nvidia-l4", gpus_per_node = 1, gpu_memory_gib = 24 } },
{ name = "gpu-l4-16", machine_type = "g2-standard-16", max_size = 2, gpu = { type = "nvidia-l4", gpus_per_node = 1, gpu_memory_gib = 24 } },
]
}
}

Terraform modules, own cluster. Describe the gpu pool in cluster_config (node_groups with gpu_memory_gib and gpus_per_node):

cluster_config (part)
node_pools = {
# ... the pools ui, batch and backend
gpu = {
node_selector = { "platforma.bio/pool" = "gpu" }
tolerations = [{ key = "platforma.bio/pool", operator = "Equal", value = "gpu", effect = "NoSchedule" }]
node_groups = [
{ name = "gpu-l4", max_size = 2, gpu_memory_gib = 24, gpus_per_node = 1, allocatable = { cpu = 15, memory_gib = 58 } },
]
}
}

Helm chart. Set jobs.maxRequest.gpu: { vram, cpu, memory } of one GPU node. Without it, the Backend does not run GPU jobs.

values.yaml
jobs:
maxRequest:
cpu: 15
memory: 55Gi
gpu: { vram: 24Gi, cpu: 15, memory: 58Gi }

For what each GPU node must have, see GPU nodes. For the time a GPU job waits for a node, see Attempts and time limits.

Scratch volumes

A scratch volume is the temporary disk of one job. Only the jobs that ask for scratch space get one, and the Backend keeps the size of each request between the smallest and the largest size of the StorageClass. Without scratch, a job keeps its temporary files on the workspaceworkspace — The storage where the Backend and all jobs keep the working files of running jobs. The Backend and the jobs use it at the same time. In Kubernetes, it is a network file system; in Single Server mode, it is a folder on the server. Glossary. For why scratch lowers the bill and the run time, and what its StorageClass must have, see Scratch volumes.

Terraform modules, AWS. Scratch is always on: platforma-tf-cloud-cluster makes the StorageClass. In disks.scratch of platforma-tf-cloud-base, you can set the disk:

  • type: gp3 (default), io1 or io2;
  • iops and throughput_mibps: 16000 and 1000 MiB/s by default. The module computes the smallest size from the IOPS;
  • max_size: 16Ti by default; at least 16Ti, and not more than the type allows (64Ti for io2);
  • encrypted: true by default.

Terraform modules, Google Cloud. Scratch is on by default: disks.scratch.enabled of platforma-tf-cloud-base. type (hyperdisk-balanced by default), iops and throughput_mibps work as on AWS.

Inputs of platforma-tf-cloud-base (AWS)
disks = {
scratch = { type = "io2", iops = 32000, max_size = "64Ti" }
}

Terraform modules, own cluster. Set cloud_values.volumes.scratch in cluster_config: enabled = true, storage_class (default platforma-scratch), max_size (default 16Ti) and, when the disk type needs a minimum size for its speed, min_size.

cluster_config (part)
cloud_values = {
# ... other keys of cloud_values
volumes = {
scratch = { enabled = true, storage_class = "platforma-scratch", max_size = "16Ti" }
}
}

Helm chart. Set volumes.scratch: enabled: true, storageClass, maxSize and minSize. Off by default.

values.yaml
volumes:
scratch:
enabled: true
storageClass: platforma-scratch
maxSize: 16Ti

MiLaboratories recommends 16000 IOPS, 1000 MiB/s and encryption for each volume. Each node also has a limit of attached volumes, which limits how many jobs with scratch run on one node.

Attempts and time limits

Attempts. A Block can run a failed job again, for example the CPU variant of a job after a GPU job did not get a GPU node. The Backend limits the number of runs of one job, the first run included; 1 means no second run. Set it in backend_service.jobs.scheduling.max_attempts (Terraform), jobs.scheduling.maxAttempts (Helm) or --runner-max-job-attempts (PL_RUNNER_MAX_JOB_ATTEMPTS, Single Server mode). A lower number makes a Block fail sooner; a higher number lets it try more times.

The other limits are for a Kubernetes cluster:

Setting Terraform modules (backend_service.jobs) Helm chart (jobs) Default What it does
Wait for the pods scheduling.warmup_timeout scheduling.warmupTimeout 30m After Kueue admits a job, all its pods must be ready in this time (node start, volumes, image pull), else the job fails. More than 0, at most 24h
Wait for a GPU node scheduling.gpu_timeout scheduling.gpuTimeout 10m A GPU job that is not on a GPU node in this time fails, and the Block can run its CPU variant. Lower than the wait for the pods. 0 = off: a GPU job waits as any other job
Slow image pull image_pull_max_retries imagePullMaxRetries 2 Extra attempts for a job whose node was too slow to pull the image. 0 = none
terraform.tfvars
backend_service = {
jobs = {
scheduling = { max_attempts = 2, warmup_timeout = "1h", gpu_timeout = "5m" }
image_pull_max_retries = 2
}
}
values.yaml
jobs:
scheduling: { maxAttempts: 2, warmupTimeout: 1h, gpuTimeout: 5m }
imagePullMaxRetries: 2

A longer wait for the pods helps when new nodes or large images are slow, but a job that cannot start fails later. A shorter wait for a GPU node gives the CPU variant sooner when GPU machines are rare in the region.

Cleanup. In a Kubernetes cluster, a CronJob removes the finished AppWrappers of the release (Succeeded or Failed) each day at 03:00, when they are older than 120 hours. Set it in backend_service.cleanup.app_wrappers (Terraform) or cleanup.appWrappers (Helm): enabled, schedule and the age (max_age, maxAge).

Single Server mode

In Single Server mode, all jobs share the server. By default, the Backend gives the jobs 95% of the memory and all CPUs; for how it starts jobs with them, see How jobs get computing power.

Option (environment variable) What it sets Default
--runner-local-memory (PL_RUNNER_LOCAL_MEMORY) The memory for jobs: an amount, for example 200GiB, or a percentage, for example 90%. A percentage of more than 100 is refused 95% of the memory limit of the Backend (container or systemd unit), else of the server
--runner-local-cpu (PL_RUNNER_LOCAL_CPU) The CPUs for jobs all CPUs of the server

The Backend splits this memory and these CPUs between its four queues. To see the split before you start the Backend, run platforma --get-queue-limits with the same options: it prints the limits of each queue and stops. For examples of how much memory the analyses need, see Memory examples.

A change. Less memory for jobs leaves more for other programs on the server, but fewer jobs run at the same time, and large jobs get a reduced request. More memory than the server can give lets the system stop processes when the memory is full.

For the largest job and GPU jobs in Single Server mode, see Largest job and GPU nodes.

Problems

Jobs wait in the queue while nodes are free

Cause: the quota of the queue is smaller than the capacity of the nodes. Fix: set a larger quota, up to the capacity: see Node pools and quotas.

Jobs wait, and no node starts

Cause: the node groups are at their max_size, or the vCPU or GPU quota of the cloud account is full. Fix: raise max_size, or ask the cloud for a larger quota: see How to limit the cost.

The log says that a resource request was made smaller

Cause: a Block asked for more than the largest job. The job can run out of memory. Fix: add a node group with more memory (Kubernetes) or more memory for jobs (Single Server mode).

A GPU job ran its CPU variant

Cause: the job did not get a GPU node before the GPU wait ended. Fix: check the GPU quota of the cloud and the GPU node groups, or set a longer gpu_timeout.

A job fails some time after it was admitted

Cause: its pods were not ready before the wait for the pods ended: a slow node start, a slow image pull or a volume that cannot attach. Fix: find the cause in the events of the pod, or set a longer warmup_timeout. For more, see Troubleshooting jobs.

Limits

  • One job runs on one node: a job cannot use more than one node.
  • Job nodes are amd64 machines.
  • The cloud-specific Terraform modules use on-demand nodes for jobs, not spot or preemptible nodes.

Next