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:
- Queues: how jobs wait for compute.
- Node pools and quotas: node shapes, maximum sizes, quotas.
- Largest job: the largest request of one job.
- Scaling: nodes from zero, and ProvisioningRequest.
- GPU nodes: optional, for Blocks that use a GPU.
- Scratch volumes: the temporary disk of a job.
- Attempts and time limits: runs again and waits.
- Single Server mode: memory and CPUsCPUs — The compute units of a node or of the server, as Kubernetes and the operating system count them. A job asks for a number of CPUs. The cloud quotas call them vCPUs. Glossary for jobs.
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 |
components = { kueue = { ui_borrows_batch_quota = false } queue_statistics = { enabled = false }}jobs: queueStatistics: falseWith 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.
The four queues share the memory and the CPUs of the server: see Single Server mode.
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.
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:
truewhen a cluster autoscaler adds the job nodes: the quota ismax_size×allocatable, or a lower value that you set;falsefor a fixed set of nodes: set the quota and theallocatableof each node group, or set none of them, and the module reads the ready nodes of the pool.
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
allocatableof the node groups incluster_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 batchbatch = {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.maxRequestis required and does not have a default. Setcpu(a whole number) andmemory, and for GPU jobsgpu: { vram, cpu, memory }.
jobs: maxRequest: cpu: 15 memory: 55Gi--runner-max-cpu-request (PL_RUNNER_MAX_CPU_REQUEST) and --runner-max-memory-request
(PL_RUNNER_MAX_MEMORY_REQUEST) set the limit. By default, both are not set: the Backend sets no
limit of its own, and a job gets at most the memory and the CPUs of its queue (see
Single Server mode).
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_requestofplatforma-tf-cloud-base(AWS and Google Cloud); - in
cluster_config.autoscaling.provisioning_requestofplatforma-tf-services-clusteron an own cluster. A class there needsautoscaling.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.
provisioning_request = { cpu = "best-effort-atomic-scale-up.autoscaling.x-k8s.io" gpu = null}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_sizeandgpu = { gpus_per_node, gpu_memory_gib }(gpu_memory_gibis the VRAM of one GPU). The instance type sets the GPU, so AWS does not usegpu.type; - Google Cloud:
machine_type,max_sizeandgpu = { 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.
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 } }, ] }}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):
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.
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.
--runner-gpu-available (PL_RUNNER_GPU_AVAILABLE) sets GPU jobs:
auto(default): GPU jobs are on when Docker on the server has the NVIDIA runtime. This is the only GPU thatautofinds;enabled: GPU jobs are on. Then also set--runner-gpu-max-vram-request(PL_RUNNER_GPU_MAX_VRAM_REQUEST), the VRAM of the GPU;disabled: GPU jobs are off.
A server without Docker. Set --runner-gpu-available=enabled and
--runner-gpu-max-vram-request: the GPU jobs then run on the server, with the GPU driver of the
server.
A server with Docker. Install the NVIDIA runtime of Docker (the NVIDIA Container Toolkit). With
enabled and without this runtime, the Backend does not start.
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),io1orio2;iopsandthroughput_mibps: 16000 and 1000 MiB/s by default. The module computes the smallest size from the IOPS;max_size:16Tiby default; at least16Ti, and not more than the type allows (64Tiforio2);encrypted:trueby 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.
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.
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.
volumes: scratch: enabled: true storageClass: platforma-scratch maxSize: 16TiMiLaboratories 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.
There are no scratch volumes: a job keeps its temporary files in its working folder on the server.
Do not set --has-scratch-space: it tells the Blocks that scratch volumes exist, and a Block that
sees it stops the management of its own temporary files.
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 |
backend_service = { jobs = { scheduling = { max_attempts = 2, warmup_timeout = "1h", gpu_timeout = "5m" } image_pull_max_retries = 2 }}jobs: scheduling: { maxAttempts: 2, warmupTimeout: 1h, gpuTimeout: 5m } imagePullMaxRetries: 2PL_RUNNER_MAX_JOB_ATTEMPTS=2A 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.