ResourcePlan#

Run commands and agent-written programs inside an operating-system boundary. See the guide.

class zett_agent.sandbox.resources.ResourcePlan(report, rlimits=(), cgroup=None, watchdog=False, warnings=(), sample_seconds=0.25)[源代码]#

What will be done about resources for one run.

参数:
report#

The mechanism behind each limit, before the run measured anything.

Type:

zett_agent.sandbox.resources.ResourceReport

rlimits#

The setrlimit calls to make in the child.

Type:

tuple[zett_agent.sandbox.resources.RlimitStep, ...]

cgroup#

The group the child joins, when one was created.

Type:

zett_agent.sandbox.resources.CgroupHandle | None

watchdog#

Whether the parent samples the process group's memory.

Type:

bool

warnings#

Limits that were asked for and cannot be enforced here.

Type:

tuple[str, ...]

sample_seconds: float#

The watchdog's sampling interval, from the limits it was planned for.

preexec()[源代码]#

Return a callable for subprocess' preexec_fn, or None when nothing to do.

返回类型:

Callable[[], None] | None

cleanup()[源代码]#

Release what planning created.

返回类型:

None

measured(*, peak_memory_bytes, limits_hit, warnings=())[源代码]#

Return the report with what the run observed added to it.

参数:
  • peak_memory_bytes (int | None)

  • limits_hit (tuple[str, ...])

  • warnings (tuple[str, ...])

返回类型:

ResourceReport