Skip to main content

kule limits

Show or set what an agent run may take of this computer: processor, memory, disk, GPU and time.

Synopsis​

kule limits [OPTIONS] [SETTINGS]...

Description​

Limits hold each agent run of a task. They can be set at three scopes:

ScopeHow to pick itHolds
Every taskno option (the default)Every task, where neither its group nor the task sets its own.
Each task in a group--group IDEach task in that group, field by field, where the task sets none of its own.
One task--task TASKThat task only.

A task's own value stands over its group's, and a group's over every task's. A group's limit holds each of its tasks on its own: cpu=2 on a group means 2 cores for each task, not 2 cores shared.

Without settings, the command prints the limits of the scope. With settings, it changes them and then prints them. Each line says where its value comes from, so you always see which scope you changed.

A run that is going on keeps the limits it started with. A change holds from the next run. kule run and runs from the app are held to the same limits.

The fields​

FieldUnitWhat happens over it
cpucores (1.5 is one and a half)The run is slowed down, not stopped: Kule pauses and resumes its processes in turn.
memoryGB, all of the run's processes togetherThe processes are killed at once and the run stops.
diskGB the copy, its temporary files and home changes may grow by since the task was madeThe run stops. No single file can be written past it.
gpuon / offoff: on macOS Metal (and OpenCL) gets no device; on Linux the GPU's devices stay read-only.
runminutes, one runThe run stops. Time waiting for your answers counts.
taskhours, all of the task's runs added upThe run stops, and no new run starts until you raise it.
idleminutes doing nothingThe run stops. "Doing nothing" means no message, tool call, output, processor use or new process from the agent. A question waiting for you does not count.

Values​

ValueMeaning
a number above 0The limit, in the field's unit (memory=4, cpu=1.5, run=30).
noneNo limit for this field at this scope.
on, offFor gpu only.
inheritWith --group or --task only: drop this scope's own value and take the one from the scope above again.

Arguments​

ArgumentMeaning
SETTINGS...Zero or more FIELD=VALUE pairs, such as memory=4 cpu=none gpu=off.

Options​

OptionValueDefaultMeaning
--groupgroup idShow or set the limits for each task in this group. See kule group for ids.
--tasktask idShow or set this task's own limits.
--homepath~/.kule (or KULE_HOME)Kule's home. See global options.
-h, --helpPrint help.

--group and --task cannot be used together.

Examples​

The defaults, with nothing set:

$ kule limits
limits for EVERY TASK (where its group and the task set none of their own):
processor no limit
memory no limit
disk no limit
one run no limit
all of a task's runs no limit
doing nothing no limit
GPU may be used

Hold every task to 1.5 cores and 4 GB, stop runs that sit idle for 10 minutes, and turn the GPU off:

$ kule limits cpu=1.5 memory=4 idle=10 gpu=off
limits for EVERY TASK (where its group and the task set none of their own):
processor 1.5 cores
memory 4 GB
disk no limit
one run no limit
all of a task's runs no limit
doing nothing 10 min
GPU off

Tighter limits for each task in group 1:

$ kule limits --group 1 memory=2 run=30
limits for EACH TASK IN GROUP 1 "clients" (1 task), where a task sets none of its own:
processor 1.5 cores (every task's)
memory 2 GB (the group's)
disk no limit (every task's)
one run 30 min (the group's)
all of a task's runs no limit (every task's)
doing nothing 10 min (every task's)
GPU off (every task's)

One task in that group needs more memory:

$ kule limits --task 1046fb30 memory=8
limits for TASK 1046fb30 only (in group 1 "clients"):
processor 1.5 cores (every task's)
memory 8 GB (its own)
disk no limit (every task's)
one run 30 min (group "clients")
all of a task's runs no limit (every task's)
doing nothing 10 min (every task's)
GPU off (every task's)

Give it back to the group's value:

$ kule limits --task 1046fb30 memory=inherit
limits for TASK 1046fb30 only (in group 1 "clients"):
processor 1.5 cores (every task's)
memory 2 GB (group "clients")
...

Output​

  • The first line names the scope in capitals: EVERY TASK, EACH TASK IN GROUP …, or TASK … only.
  • At a group or task scope, the brackets say where each value comes from: (its own), (the group's) / (group "clients"), or (every task's).
  • no limit means nothing holds that field; may be used means the GPU is on.

Errors and fixes​

MessageWhat to do
kule: memory: write a limit as FIELD=VALUE, such as memory=4Add = and a value.
kule: foo: a limit is cpu, memory, disk, gpu, run, task or idleUse one of these field names.
kule: memory=0: a number of GB above 0, or noneUse a positive number; none removes the limit.
kule: gpu: on, off or inheritgpu takes only these words.
kule: memory: `inherit` is for --group or --task; the limits for every task have nothing above themAt the every-task scope, use a value or none.
error: the argument '--group <GROUP>' cannot be used with '--task <TASK>'Pick one scope.
kule: no group 9 / kule: no task …Check the id with kule group or kule list.

When a limit stops a run, the run fails with the reason in Live and in kule run's output, for example Stopped: the run's processes held 4.2 GB, over its memory limit of 4 GB.

In the app​

Settings → Limits, where Applies to picks Every task, One group or One task. Limits… in a task's or a group's ⋮ menu opens that scope, and the measure bar under the prompt in Live opens the task's. Moving a task into or out of a group asks first when its limits would change.

See also​