Skip to main content

Use thresholds and resources

Thresholds and resources let jobs coordinate beyond simple "run after" ordering: gate a job on a value, or limit how many jobs hit a shared system at once.

What this solves

Simple "run after" ordering can't express "wait until enough is done" or "don't let too many jobs hit this system at once", so jobs either start too early or overwhelm a shared database or host.

Thresholds: gate a job on a value​

A threshold is a named number. A job can depend on it and wait until it reaches a required value: useful for "wait until N things are done" style gating.

To use a threshold, complete the following steps:

  1. Go to Toolkit → Thresholds, select New Threshold, and give it a name and a starting value. Everything is set in one dialog over the list.
  2. In a job's Dependencies tab, add a threshold dependency and set the value it requires.

Resources: limit concurrency​

A resource is a named pool with a total capacity. A job reserves units while it runs and releases them when it finishes, so you can cap how many jobs run against a shared system (a core database, say) at the same time.

To use a resource, complete the following steps:

  1. Go to Toolkit → Resources, select New Resource, and give it a total capacity.
  2. In a job's Dependencies tab, add a resource dependency and set the units it needs.
Good to know
  • A job waiting on a resource shows a waiting on resource status until enough units are free; a job waiting on a threshold shows waiting on threshold. The units are taken only when the job is dispatched, so if another job takes them first it waits again in waiting to start.
  • Thresholds and resources are workspace-scoped: a job can only use ones in its workspace.
  • Size a resource's total to the real limit of the system you're protecting.
  • To see who is holding a resource right now, use Current Allocations on its row and pick an environment: you get units in use against the total, what's available, and a row per live allocation naming the job and workflow instance holding it.
  • Deleting a threshold or resource that a job depends on is refused, and the confirmation lists the jobs that depend on it — so you know what to unpick first.

Related topics