CgroupV2#

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

class zett_agent.sandbox.resources.CgroupV2(directory, _delegated=None)[源代码]#

The cgroup v2 hierarchy, and whether it can host a sandbox's own group.

参数:
  • directory (Path)

  • _delegated (bool | None)

classmethod discover(*, mount=None, cgroup_path=None)[源代码]#

Return the hierarchy this process could create a group in, or None.

None means the machine has no cgroup v2, or this process is not in one. Whether the controllers are delegated is a separate question, asked by delegated(), because answering it creates and removes a directory.

参数:
  • mount (Path | None)

  • cgroup_path (Path | None)

返回类型:

CgroupV2 | None

delegated()[源代码]#

Whether a child cgroup can be created here, probed once and remembered.

返回类型:

bool

create(name)[源代码]#

Create one group for one run, or None when this hierarchy cannot hold it.

参数:

name (str)

返回类型:

CgroupHandle | None