CgroupHandle#
Run commands and agent-written programs inside an operating-system boundary. See the guide.
- class zett_agent.sandbox.resources.CgroupHandle(path, applied=<factory>, dry_run=False)[源代码]#
One cgroup created for one run: it is created by the parent, joined by the child.
- 参数:
path (Path)
applied (dict[str, str])
dry_run (bool)
- applied: dict[str, str]#
Limits the kernel accepted, keyed the way
ResourceReportnames them.
- dry_run: bool = False#
True when this handle only answers what would happen, for
capabilities(), and changes nothing.
- set_memory(memory_bytes)[源代码]#
Cap the group's memory and stop it from swapping its way around the cap.
- 参数:
memory_bytes (int)
- 返回类型:
bool
- set_cpu_percent(cpu_percent)[源代码]#
Give the group
cpu_percentof one processor, as a quota per period.- 参数:
cpu_percent (int)
- 返回类型:
bool
- set_processes(processes)[源代码]#
Cap how many processes and threads the group may hold.
- 参数:
processes (int)
- 返回类型:
bool
- join()[源代码]#
Move the calling process into this cgroup. Runs in the child before
exec.Writing
0tocgroup.procsmoves the writer, so the command and everything it starts are charged to this group from the first instruction on. Nothing is raised: the child has to reachexec.- 返回类型:
None