Skip to main content

Allocation policy

An allocation policy decides on which host each task runs, and when. A policy is either a ready-made prefab, or a filter policy built from filters and weighers.

Filter policies​

A filter policy places each task in two steps:

  1. The filters remove the hosts that cannot run the task.
  2. The weighers score the remaining hosts. Each weigher's scores are scaled to between 0 and its multiplier, and added up. The task goes to the host with the highest total. A negative multiplier prefers low values instead of high ones.
FieldTypeDefaultDescription
filterslist of filters[{ "type": "compute" }]The filters, all of which a host must pass.
weigherslist of weighers[]The weighers that rank the hosts.
timeshifttime-shiftingnoneDelays tasks while the carbon intensity is high.
{
"type": "filter",
"filters": [
{ "type": "compute" },
{ "type": "vcpu", "allocationRatio": 1.0 },
{ "type": "ram" }
],
"weighers": [
{ "type": "ram", "multiplier": 1.0 }
]
}

Filters​

TypeFieldsKeeps the hosts that
computeare up.
vcpuallocationRatio (default 1.0)have enough free CPU cores. An allocationRatio above 1 allows overcommitting cores.
vcpuCapacityhave cores at least as fast as the task needs.
ramallocationRatio (default 1.0)have enough free memory. Do not change allocationRatio: overcommitting memory is not supported yet.
vgpuallocationRatio (default 1.0)have enough free GPU cores.
instanceCountlimitrun fewer than limit tasks.
sameHostCurrently has no effect.
differentHostCurrently has no effect.

Weighers​

Every weigher has a multiplier (default 1.0).

TypeScores a host by
ramits free memory.
coreRamits free memory per core.
instanceCountthe number of tasks it runs.
vcpuCapacityits total CPU capacity.
vcpuhow few CPU cores are provisioned on it. A higher score means fewer cores in use.
vgpuhow few GPU cores are provisioned on it.

Time-shifting​

With timeshift, the policy delays deferrable tasks while the carbon intensity of the power source is high, as long as they can still meet their deadline. Tasks shorter than two hours use shortForecastThreshold, longer tasks use longForecastThreshold. The carbon intensity comes from the carbon trace of the power source.

FieldTypeDefaultDescription
forecastbooleantrueCompare the carbon intensity with a forecast. Otherwise, compare it with the mean of the last windowSize values.
forecastSizeinteger24The number of forecasted values to compare with.
shortForecastThresholdnumber0.2The carbon intensity is low for short tasks when it is below this quantile of the forecast.
longForecastThresholdnumber0.35The same, for long tasks.
windowSizeinteger168The number of past values in the mean.
taskStoppertask stoppernoneAlso pauses running tasks while the carbon intensity is high.

Task stopper​

FieldTypeDefaultDescription
forecastbooleantrueUse a forecast instead of past values.
forecastSizeinteger24The number of forecasted values.
forecastThresholdnumber0.6The threshold, between 0 and 1, above which tasks are paused.
windowSizeinteger168The number of past values used.
{
"type": "filter",
"filters": [{ "type": "compute" }, { "type": "vcpu" }, { "type": "ram" }],
"weighers": [{ "type": "ram" }],
"timeshift": {
"shortForecastThreshold": 0.2,
"longForecastThreshold": 0.35,
"taskStopper": { "forecastThreshold": 0.6 }
}
}

Prefabs​

A prefab is a ready-made filter policy, selected by name:

{ "type": "prefab", "prefabName": "Mem" }

All prefabs use the compute, vcpu and ram filters. The GPU prefabs also use the vgpu filter.

PrefabWeighersNotes
Memram (1.0)The default policy.
MemInvram (-1.0)
CoreMemcoreRam (1.0)
CoreMemInvcoreRam (-1.0)
ActiveServersinstanceCount (-1.0)
ActiveServersInvinstanceCount (1.0)
ProvisionedCoresvcpu (1.0)
ProvisionedCoresInvvcpu (-1.0)
TaskNumMemorizinginstanceCount (-1.0)
Timeshiftram (1.0)With time-shifting, using its defaults.
ProvisionedCpuGpuCoresvcpu (1.0), vgpu (1.0)GPU prefab.
ProvisionedCpuGpuCoresInvvcpu (-1.0), vgpu (-1.0)GPU prefab.
GpuTaskMemorizinginstanceCount (-1.0)GPU prefab.