Child Spaces (experiment)
Let a Space make Spaces of its own, set the budget of its tree and list orphans.
These calls belong to the Child Spaces experiment (cua experiments enable child-spaces) and are refused while it is off. set_children lets a Space make children through a channel only it can reach; tree_budget and set_tree_budget bound what a tree may hold and spend; orphans lists children whose parent is gone. See Child Spaces.
Children#
Methods of Spaces.
Spaces.set_children#
Lets a Space make child Spaces of its own, or stops it. While on,
cua, the SDKs and the agent's tools in that Space create, list and
delete Spaces that belong to it (on the same computer, never wider
than it, ending no later than it), through a channel only it can
reach. Off ends its capability at once; children it made keep running
until deleted or their lifetime ends. Only for a Space the machine of
this runtime runs itself.
async def set_children(self, space: str, enabled: bool) -> None| Parameter | Type | Default |
|---|---|---|
space | String | required |
enabled | bool | required |
Async · Raises CuaError
Spaces.tree_budget#
The budget of space's tree (any Space of it) and what its
children use now. Kept by the cua daemon.
async def tree_budget(self, space: str) -> TreeBudget| Parameter | Type | Default |
|---|---|---|
space | String | required |
Returns TreeBudget · Async · Raises CuaError
Spaces.set_tree_budget#
Sets the budget of space's tree: how many child Spaces, vCPUs and
memory its children may hold at once, and what they may cost. A child
that does not fit is refused with what is left. All None removes it.
async def set_tree_budget(self, space: str, limits: TreeBudgetLimits) -> TreeBudget| Parameter | Type | Default |
|---|---|---|
space | String | required |
limits | TreeBudgetLimits | required |
Returns TreeBudget · Async · Raises CuaError
Spaces.orphans#
Child Spaces whose parent is gone or out of reach. The cua daemon ends a child only on proof its parent is gone (after a grace period); the rest are listed here and never ended by it.
async def orphans(self) -> List[SpaceOrphan]Returns Vec<SpaceOrphan> · Async · Raises CuaError
TreeBudget record#
A tree's budget and what its children use (Spaces.tree_budget).
Returned by Spaces.set_tree_budget, Spaces.tree_budget.
| Field | Type | Default | Description |
|---|---|---|---|
root | String | The tree's top-level Space. | |
set | TreeBudgetLimits | What the owner set. | |
max_spaces / maxSpaces | u32 | Child Spaces it may hold at once. | |
max_vcpus / maxVcpus | u32 | vCPUs it may hold at once. | |
max_memory_mb / maxMemoryMb | u64 | Memory it may hold at once (MiB). | |
usd_per_hour / usdPerHour | f64 | Cost per hour it may run at. | |
usd_total / usdTotal | Option<f64> | Cost in total it may reach, when capped. | |
spaces | u32 | Child Spaces now. | |
vcpus | u32 | vCPUs they hold. | |
memory_mb / memoryMb | u64 | Memory they hold (MiB). | |
usd_per_hour_used / usdPerHourUsed | f64 | Cost per hour they run at. | |
usd_spent / usdSpent | f64 | What they have cost so far. |
TreeBudgetLimits record#
What a tree's children may hold and cost (Spaces.set_tree_budget).
None: the default.
| Field | Type | Default | Description |
|---|---|---|---|
max_spaces / maxSpaces | Option<u32> | None | Child Spaces at once (default 16). |
max_vcpus / maxVcpus | Option<u32> | None | vCPUs at once (default 16). |
max_memory_mb / maxMemoryMb | Option<u64> | None | Memory at once, MiB (default 32768). |
usd_per_hour / usdPerHour | Option<f64> | None | Cost per hour, in linked clouds (default 2.0). |
usd_total / usdTotal | Option<f64> | None | Cost in total (default: none). |
SpaceOrphan record#
A child Space whose parent is gone or out of reach (Spaces.orphans).
Returned by Spaces.orphans.
| Field | Type | Default | Description |
|---|---|---|---|
space | String | The child. | |
parent | String | Its parent's id. | |
state | String | ending (its parent is provably gone: it ends after the grace) or listed (not this computer's to judge: it stays until deleted or its own lifetime ends). | |
why | String | Why. | |
ends_in_secs / endsInSecs | i64 | Seconds until it ends (ending only). |