laila¶
laila
¶
Laila top-level package.
Provides the public API for policy management, subsystem access
(laila.memory, laila.command, laila.communication),
future lifecycle helpers, and argument loading.
AUTO_INITIALIZE_POLICY = True
module-attribute
¶
bool(x) -> bool
Returns True when the argument x is true, False otherwise. The builtins True and False are the only two instances of the class bool. The class bool is a subclass of the class int, and cannot be subclassed.
LAILA_DEFAULT_DIRECTORIES = {'root': '/home/ubuntu/.laila', 'pools': '/home/ubuntu/.laila/pools', 'logs': '/home/ubuntu/.laila/logs', 'secrets': '/home/ubuntu/.laila/secrets'}
module-attribute
¶
dict() -> new empty dictionary dict(mapping) -> new dictionary initialized from a mapping object's (key, value) pairs dict(iterable) -> new dictionary initialized as if via: d = {} for k, v in iterable: d[k] = v dict(**kwargs) -> new dictionary initialized with the name=value pairs in the keyword argument list. For example: dict(one=1, two=2)
LAILA_UNIVERSAL_NAMESPACE = UUID('6c8dcd4c-d490-58bc-81a7-6afbe8d17594')
module-attribute
¶
Instances of the UUID class represent UUIDs as specified in RFC 4122. UUID objects are immutable, hashable, and usable as dictionary keys. Converting a UUID to a string with str() yields something in the form '12345678-1234-1234-1234-123456789abc'. The UUID constructor accepts five possible forms: a similar string of hexadecimal digits, or a tuple of six integer fields (with 32-bit, 16-bit, 16-bit, 8-bit, 8-bit, and 48-bit values respectively) as an argument named 'fields', or a string of 16 bytes (with all the integer fields in big-endian order) as an argument named 'bytes', or a string of 16 bytes (with the first three fields in little-endian order) as an argument named 'bytes_le', or a single 128-bit integer as an argument named 'int'.
UUIDs have these read-only attributes:
bytes the UUID as a 16-byte string (containing the six
integer fields in big-endian byte order)
bytes_le the UUID as a 16-byte string (with time_low, time_mid,
and time_hi_version in little-endian byte order)
fields a tuple of the six integer fields of the UUID,
which are also available as six individual attributes
and two derived attributes:
time_low the first 32 bits of the UUID
time_mid the next 16 bits of the UUID
time_hi_version the next 16 bits of the UUID
clock_seq_hi_variant the next 8 bits of the UUID
clock_seq_low the next 8 bits of the UUID
node the last 48 bits of the UUID
time the 60-bit timestamp
clock_seq the 14-bit sequence number
hex the UUID as a 32-character hexadecimal string
int the UUID as a 128-bit integer
urn the UUID as a URN as specified in RFC 4122
variant the UUID variant (one of the constants RESERVED_NCS,
RFC_4122, RESERVED_MICROSOFT, or RESERVED_FUTURE)
version the UUID version number (1 through 5, meaningful only
when the variant is RFC_4122)
is_safe An enum indicating whether the UUID has been generated in
a way that is safe for multiprocessing applications, via
uuid_generate_time_safe(3).
__cached__ = '/home/ubuntu/laila-core/__pycache__/__init__.cpython-312.pyc'
module-attribute
¶
str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str
Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to sys.getdefaultencoding(). errors defaults to 'strict'.
__doc__ = 'Laila top-level package.\n\nProvides the public API for policy management, subsystem access\n(``laila.memory``, ``laila.command``, ``laila.communication``),\nfuture lifecycle helpers, and argument loading.\n'
module-attribute
¶
str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str
Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to sys.getdefaultencoding(). errors defaults to 'strict'.
__file__ = '/home/ubuntu/laila-core/__init__.py'
module-attribute
¶
str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str
Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to sys.getdefaultencoding(). errors defaults to 'strict'.
__name__ = 'laila'
module-attribute
¶
str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str
Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to sys.getdefaultencoding(). errors defaults to 'strict'.
__package__ = 'laila'
module-attribute
¶
str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str
Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to sys.getdefaultencoding(). errors defaults to 'strict'.
__path__ = ['/home/ubuntu/laila-core']
module-attribute
¶
Built-in mutable sequence.
If no argument is given, the constructor creates a new empty list. The argument must be an iterable if specified.
arg_reader = <laila.utils.args.args.ArgReader object at 0x7e0d22501910>
module-attribute
¶
Load runtime args from simple key/value sources into the target mapping
(defaults to laila.args). All load / from_* methods mutate
the target in place and return None.
guarantee = <laila.utils.guarantee._Guarantee object at 0x7e0d272f35c0>
module-attribute
¶
Synchronous context manager that waits for futures created inside its scope.
On exit, every future registered while the context was active is waited on. If any future raised, the first exception is re-raised.
guarantee_async = <laila.utils.guarantee._AsyncGuarantee object at 0x7e0d272f35f0>
module-attribute
¶
Asynchronous context manager that awaits futures created inside its scope.
A background watcher task monitors child futures and propagates the first exception by cancelling the parent task.
ArgReader
¶
Load runtime args from simple key/value sources into the target mapping
(defaults to laila.args). All load / from_* methods mutate
the target in place and return None.
Source code in utils/args/args.py
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 | |
__init__(target=None)
¶
Initialise the reader.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
target
|
Any
|
Object to set attributes on. Defaults to |
None
|
clear()
¶
Remove all keys from the target mapping.
from_json(path)
¶
Load arguments from a JSON file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str or Path
|
Path to the |
required |
Source code in utils/args/args.py
from_toml(path)
¶
Load arguments from a TOML file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str or Path
|
Path to the |
required |
Source code in utils/args/args.py
from_env(path)
¶
Load arguments from a .env-style file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str or Path
|
Path to the |
required |
Source code in utils/args/args.py
from_xml(path)
¶
Load arguments from an XML file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str or Path
|
Path to the |
required |
Source code in utils/args/args.py
from_terminal(args=None)
¶
Load arguments from key=value command-line tokens.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
args
|
Iterable[str]
|
Tokens to parse. Defaults to |
None
|
Source code in utils/args/args.py
load(source, *, terminal_args=None)
¶
Auto-detect format and load arguments.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
source
|
str or Path
|
File path (suffix selects format) or the literal |
required |
terminal_args
|
Iterable[str]
|
Passed to :meth: |
None
|
Raises:
| Type | Description |
|---|---|
ValueError
|
If the file suffix is not supported. |
Source code in utils/args/args.py
DefaultCentralCommand
¶
Bases: _LAILA_CLI_CAPABLE_CLASS, _LAILA_IDENTIFIABLE_OBJECT
Central command that manages task-forces, future submission, and guarantees.
Source code in policy/central/command/schema/base.py
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 | |
model_post_init(__context)
¶
Create a default task-force and set it as alpha if none provided.
Source code in policy/central/command/schema/base.py
add_taskforce(taskforce)
¶
Register a task-force with this central command.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
taskforce
|
_LAILA_IDENTIFIABLE_TASK_FORCE
|
The task-force instance to register. |
required |
Source code in policy/central/command/schema/base.py
submit(tasks, wait=False, *, taskforce_id=None)
¶
Submit tasks to a task-force for execution.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
tasks
|
Iterable[Callable[[], Any]]
|
Zero-arg callables to execute. |
required |
wait
|
bool
|
If |
False
|
taskforce_id
|
str
|
Target task-force; defaults to the alpha task-force. |
None
|
Returns:
| Type | Description |
|---|---|
Future or list[Any] or Any
|
A future (or group future) when wait is |
Source code in policy/central/command/schema/base.py
shutdown(wait=True, cancel_pending=False)
¶
Shut down all registered task-forces.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
wait
|
bool
|
Block until workers finish. |
True
|
cancel_pending
|
bool
|
Cancel queued but un-started tasks. |
False
|
Source code in policy/central/command/schema/base.py
DefaultCentralCommunication
¶
Bases: _LAILA_CLI_CAPABLE_CLASS, _LAILA_IDENTIFIABLE_OBJECT
Central communication that owns transport protocols and a peer registry.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
policy_id
|
str
|
|
required |
Source code in policy/central/communication/schema/base.py
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 | |
add_connection(protocol)
¶
Register and start a transport protocol.
Sets the protocol's back-reference, adds it to the registry,
and calls protocol.start() so the connection is live when
this method returns. Symmetric with :meth:remove_connection
which calls protocol.stop().
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
protocol
|
_LAILA_IDENTIFIABLE_COMM_PROTOCOL
|
The protocol instance to register and start. |
required |
Source code in policy/central/communication/schema/base.py
remove_connection(protocol)
¶
Stop a transport protocol and remove it from this communication instance.
The protocol is responsible for all its own cleanup — closing
sockets, unregistering peers, etc. Communication only calls
stop() and removes the protocol from its registry.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
protocol
|
_LAILA_IDENTIFIABLE_COMM_PROTOCOL
|
The protocol instance to remove. |
required |
Source code in policy/central/communication/schema/base.py
start()
¶
stop()
¶
Stop all registered protocols and clear peers.
add_peer(uri, secret)
¶
Initiate a peering connection to a remote policy.
Resolves the appropriate protocol for uri and delegates the transport-level handshake.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
uri
|
str
|
URI of the remote policy (e.g. |
required |
secret
|
str
|
The remote policy's |
required |
Returns:
| Type | Description |
|---|---|
str
|
The |
Source code in policy/central/communication/schema/base.py
add_tcpip_peer(host, port, secret)
¶
Peer with a remote policy over TCP/IP (WebSocket).
Convenience wrapper that builds the ws:// URI internally.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
host
|
str
|
Hostname or IP address of the remote node. |
required |
port
|
int
|
WebSocket port on the remote node. |
required |
secret
|
str
|
The remote node's |
required |
Returns:
| Type | Description |
|---|---|
str
|
The |
Source code in policy/central/communication/schema/base.py
DefaultCentralMemory
¶
Bases: _LAILA_CLI_CAPABLE_CLASS, _LAILA_IDENTIFIABLE_OBJECT
Central memory controller for storing, retrieving, and deleting entries across pools.
Source code in policy/central/memory/schema/base.py
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 | |
model_post_init(__context)
¶
Create a default pool router and ensure an alpha pool exists.
Source code in policy/central/memory/schema/base.py
extend(pool, *, affinity=None, pool_nickname=None)
¶
Delegate pool registration to the pool router.
Source code in policy/central/memory/schema/base.py
borrow(keys=[], global_borrow=False)
¶
memorize(entries, *, pool_id=None, pool_nickname=None, affinity=None)
¶
Persist entries to the routed pool and return a GroupFuture.
Source code in policy/central/memory/schema/base.py
remember(entry_ids, *, pool_id=None, pool_nickname=None, affinity=None)
¶
Fetch entries from the routed pool and return a GroupFuture.
Source code in policy/central/memory/schema/base.py
forget(entry_ids, *, pool_id=None, pool_nickname=None, affinity=None)
¶
Delete entries from the routed pool and return a GroupFuture.
Source code in policy/central/memory/schema/base.py
DefaultPolicy
¶
Bases: _LAILA_CLI_CAPABLE_CLASS, _LAILA_IDENTIFIABLE_OBJECT
Top-level policy object that owns central command, memory, and logic.
Source code in policy/schema/base.py
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 | |
Central
¶
Bases: BaseModel
Container for the four central sub-systems of a policy.
Source code in policy/schema/base.py
model_post_init(__context)
¶
Lazily wire default central command, memory, and communication if not provided.
Source code in policy/schema/base.py
extend(new_pool)
¶
remember(global_id, *, global_fetch=False, pool_subset=None, hint=None, _remote_called=False)
¶
Fetch an entry from central memory by its global_id.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
global_id
|
str
|
The unique identifier of the entry to recall. |
required |
global_fetch
|
bool
|
If |
False
|
pool_subset
|
dict
|
Restrict the search to a subset of pools. |
None
|
hint
|
str
|
Routing hint forwarded to central memory. |
None
|
Returns:
| Type | Description |
|---|---|
Entry or None
|
The recovered entry, or |
Source code in policy/schema/base.py
memorize(entries, *, require_local_update=False, require_global_update=False)
¶
Update central memory with a new or modified entry.
Source code in policy/schema/base.py
DefaultPool
¶
Bases: _LAILA_CLI_CAPABLE_CLASS, _LAILA_LOCALLY_ATOMIC_IDENTIFIABLE_OBJECT
Abstract base class for all LAILA storage pools.
A pool is a key-value store that persists serialized Entry blobs.
Subclasses implement _read, _write, _delete,
_keys, _exists, and _empty against a concrete backend (S3,
Redis, SQLite, etc.).
Pools support a proxy relationship via _proxy_to. When a pool is
a proxy for another (its origin), reads that miss local storage
automatically fall back to the origin and cache the result locally.
Source code in pool/schema/base.py
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 | |
pool_id
property
¶
Unique identifier for this pool, aliased from global_id.
proxy
property
writable
¶
Write-only property. origin.proxy = cache sets cache._proxy_to = origin.
proxy_to
property
writable
¶
The origin pool this pool is a cache/proxy for, or None.
__lshift__(other)
¶
cache << origin: cache becomes proxy for origin.
Returns other so that chains like mem << hdf5 << s3 work.
__rshift__(other)
¶
origin >> cache: cache becomes proxy for origin.
Returns other so that chains like s3 >> hdf5 >> mem work.
__getitem__(key)
¶
Retrieve the stored blob for key, or a PoolWrapper for a Manifest.
If the key is not found locally and _proxy_to is set, the
request falls back to the origin pool. A successful fallback
caches the value in this pool before returning.
Source code in pool/schema/base.py
__setitem__(key, entry)
¶
__delitem__(key)
¶
empty()
¶
exists(key)
¶
__contains__(key)
¶
keys(as_generator=False)
¶
Return the keys stored in this pool.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
as_generator
|
bool
|
If |
False
|
Returns:
| Type | Description |
|---|---|
Iterable[str]
|
Pool keys. |
Source code in pool/schema/base.py
sync()
¶
Flush any in-memory cache to the backing store.
Raises:
| Type | Description |
|---|---|
NotImplementedError
|
If the pool is cacheless and operates directly on storage. |
Source code in pool/schema/base.py
__le__(other)
¶
Duplicate other pool's contents into this pool via the active policy.
Source code in pool/schema/base.py
DefaultPoolRouter
¶
Bases: _LAILA_CLI_CAPABLE_CLASS, _LAILA_IDENTIFIABLE_OBJECT
Routes memory operations to the appropriate pool based on affinity or nickname.
Source code in policy/central/memory/router/pool_router.py
model_post_init(__context)
¶
Register a default pool when none are provided.
Source code in policy/central/memory/router/pool_router.py
extend(pool, *, affinity=None, pool_nickname=None)
¶
Register a pool with optional affinity priority and nickname.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
pool
|
_LAILA_IDENTIFIABLE_POOL
|
The pool instance to register. |
required |
affinity
|
float
|
Routing priority (higher = preferred). Defaults to |
None
|
pool_nickname
|
str
|
Human-readable alias for this pool. |
None
|
Source code in policy/central/memory/router/pool_router.py
route(entries, *, pool_id=None, pool_nickname=None, affinity=None)
¶
Resolve the target pool for the given entries.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
entries
|
list[Entry] or list[str]
|
Entries (or entry IDs) being routed. |
required |
pool_id
|
str
|
Explicit pool |
None
|
pool_nickname
|
str
|
Nickname to resolve via |
None
|
affinity
|
float
|
Reserved for future affinity-based routing. |
None
|
Returns:
| Type | Description |
|---|---|
_LAILA_IDENTIFIABLE_POOL
|
The selected pool. |
Source code in policy/central/memory/router/pool_router.py
DefaultTCPIPProtocol
¶
Bases: _LAILA_IDENTIFIABLE_COMM_PROTOCOL
WebSocket-based peer-to-peer communication protocol.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
host
|
str
|
Bind address for the WebSocket server. |
required |
port
|
int
|
TCP port for the WebSocket server. |
required |
peer_secret_key
|
str
|
Shared secret that remote peers must supply to connect. |
required |
Source code in policy/central/communication/protocols/tcpip.py
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 | |
bound_port
property
¶
The actual port the server is listening on.
After start() this returns the OS-assigned port (useful when
port is 0). Before start() it falls back to port.
start()
¶
Boot the background event loop and WebSocket server.
Source code in policy/central/communication/protocols/tcpip.py
stop()
¶
Shut down the WebSocket server and all connections.
Source code in policy/central/communication/protocols/tcpip.py
add_peer(uri, secret)
¶
Connect to a remote policy over WebSocket.
Source code in policy/central/communication/protocols/tcpip.py
send_rpc(peer_id, path, args, kwargs)
¶
Send a JSON-RPC call over the WebSocket to peer_id.
Source code in policy/central/communication/protocols/tcpip.py
DefaultTaskForce
¶
Bases: _LAILA_IDENTIFIABLE_TASK_FORCE
Thread-pool TaskForce implementation.
Inherits shared queue management, len()/queue_len, and lifecycle surface
(start, pause, shutdown) from the base TaskForce.
This subclass implements the backend-specific hooks using a
ThreadPoolExecutor and dispatcher thread to consume items from _q.
Source code in policy/central/command/taskforce/thread_pool_executor/taskforce.py
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 | |
imap(tasks)
¶
Submit an iterable of zero-arg callables, yielding future identities in submission order.
Source code in policy/central/command/taskforce/thread_pool_executor/taskforce.py
submit(tasks, wait=False)
¶
Batch submit zero-arg callables.
Returns future identities (single) or a hollow GroupFuture (multiple) when wait is False. When wait is True, blocks and returns values.
Source code in policy/central/command/taskforce/thread_pool_executor/taskforce.py
Entry
¶
Bases: _LAILA_LOCALLY_ATOMIC_IDENTIFIABLE_OBJECT
The fundamental unit of data in LAILA.
An Entry wraps arbitrary data (tensors, images, dicts, etc.) with
identity (UUID + evolution counter), state tracking, and serialization
capabilities. Entries can be constants (immutable) or variables
(evolvable).
Create entries via the class methods Entry.variable(...) or
Entry.constant(...) rather than calling the constructor directly.
Source code in entry/entry.py
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 | |
data
property
¶
Unwrapped payload data, or None if no payload is set.
state
property
writable
¶
Current lifecycle state of this Entry.
metadata
property
¶
Entry metadata (not yet implemented).
Raises:
| Type | Description |
|---|---|
NotImplementedError
|
Always. |
__init__(**data)
¶
Initialise an Entry from keyword arguments.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
**data
|
dict
|
Accepted keys include |
{}
|
Source code in entry/entry.py
notify_policy()
¶
variable(data, *, uuid=None, evolution=None, state=None, constitution=None, global_id=None, nickname=None)
classmethod
¶
Create a mutable (evolvable) Entry.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
Any
|
The raw payload. |
required |
uuid
|
str
|
Explicit UUID. Mutually exclusive with global_id. |
None
|
evolution
|
int
|
Starting evolution counter (defaults to |
None
|
state
|
EntryState
|
Initial state; auto-set to |
None
|
constitution
|
callable
|
Not yet implemented. |
None
|
global_id
|
str
|
Composite |
None
|
nickname
|
str
|
Human-readable name used to derive a deterministic UUID. |
None
|
Returns:
| Type | Description |
|---|---|
Entry
|
A new variable Entry. |
Raises:
| Type | Description |
|---|---|
RuntimeError
|
If conflicting identity arguments are provided or both constitution and data are set. |
NotImplementedError
|
If a constitution is supplied. |
Source code in entry/entry.py
evolve(precedence=None, constitution=None, data=None)
¶
Advance the evolution counter and replace the payload.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
precedence
|
list of str
|
Reserved for constitution-based evolution. |
None
|
constitution
|
callable
|
Not yet implemented. |
None
|
data
|
Any
|
New payload data. |
None
|
Raises:
| Type | Description |
|---|---|
RuntimeError
|
If the Entry is a constant or both constitution and data are provided. |
NotImplementedError
|
If a constitution is supplied. |
Source code in entry/entry.py
constant(data, *, global_id=None, uuid=None, nickname=None)
classmethod
¶
Create an immutable Entry (evolution is None).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
Any
|
The raw payload. |
required |
global_id
|
str
|
Composite identifier (must not contain an evolution component). |
None
|
uuid
|
str
|
Explicit UUID. Mutually exclusive with global_id. |
None
|
nickname
|
str
|
Human-readable name used to derive a deterministic UUID. |
None
|
Returns:
| Type | Description |
|---|---|
Entry
|
A new constant Entry. |
Raises:
| Type | Description |
|---|---|
RuntimeError
|
If conflicting identity arguments are provided or the global_id includes an evolution component. |
Source code in entry/entry.py
contingent(**kwargs)
classmethod
¶
Create an Entry from raw keyword arguments without validation guards.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
**kwargs
|
Forwarded directly to the |
{}
|
Returns:
| Type | Description |
|---|---|
Entry
|
|
Source code in entry/entry.py
serialize(transformations=None, *, exclude_private={'_local_lock', '_payload', '_state'})
¶
Serialise the Entry into a plain dict suitable for storage.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
transformations
|
TransformationSequence
|
Pipeline applied to the serialised payload bytes. If |
None
|
exclude_private
|
set
|
Private attribute names to omit from the output dict. |
{'_local_lock', '_payload', '_state'}
|
Returns:
| Type | Description |
|---|---|
dict
|
Serialised representation including |
Source code in entry/entry.py
recover(in_dict, notify_on_creation=False)
classmethod
¶
Reconstruct an Entry from a serialised dict or JSON string.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
in_dict
|
dict or str or Entry
|
Serialised representation produced by |
required |
notify_on_creation
|
bool
|
If |
False
|
Returns:
| Type | Description |
|---|---|
Entry
|
The recovered Entry instance. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If in_dict is an invalid JSON string. |
RuntimeError
|
If the input type is unsupported. |
Source code in entry/entry.py
__str__()
¶
Future
¶
Bases: _LAILA_IDENTIFIABLE_FUTURE
Abstract Future base class with identity, outcome, and callbacks.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
future_identity
|
Identity metadata for this Future instance. |
required |
Source code in policy/central/command/schema/future/future/future.py
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 | |
status
property
writable
¶
Return the current status code for this Future.
result
property
writable
¶
Return the current result value. Releases the lock before waiting to avoid deadlock with the done callback that sets the result.
data
property
¶
Return the unwrapped payload of the result Entry.
Raises:
| Type | Description |
|---|---|
RuntimeError
|
If the result is not an Entry instance. |
exception
property
writable
¶
Return the current exception value.
future_identity
property
¶
Return a lightweight identity handle for this future.
model_post_init(__context)
¶
Wire default callbacks and register this future with the active policy.
Source code in policy/central/command/schema/future/future/future.py
add_callback(status, fn)
¶
Register a callback for a specific status transition.
remove_callback(status, fn)
¶
clear_callbacks(status)
¶
clear_all_callbacks()
¶
trigger_callback(status)
¶
Trigger the callback for the given status, if present.
wait(timeout=None)
¶
Block until the future completes. Subclasses must override.
Source code in policy/central/command/schema/future/future/future.py
finished()
¶
cancelled()
¶
error()
¶
not_started()
¶
Manifest
¶
Bases: Entry
Entry subclass wrapping a nested dict of global_id references.
A manifest maps user-defined string keys to global_id strings, lists
of global_id strings, or recursively nested dicts following the same
rules. It can be constructed from raw ID strings or from Entry
objects.
The manifest's .data IS the blueprint dict. It carries scope
MANIFEST and evolution None (constant).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
dict
|
A nested dict whose leaves are |
{}
|
uuid
|
str
|
Explicit UUID for the manifest's own identity. |
required |
nickname
|
str
|
Human-readable name converted to a deterministic UUID. |
required |
global_id
|
str
|
Composite identifier used to set identity. |
required |
Source code in policy/central/memory/schema/manifest.py
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 | |
blueprint
property
¶
The nested dict with global_id strings as leaf values.
resolved
property
¶
Synchronously fetch all referenced entries through central memory.
Walks the blueprint, recalls each entry via the memory layer's
remember path (routing, deserialization, etc.), and returns a
nested dict of Entry objects mirroring the blueprint structure.
No caching — each access re-fetches.
Raises:
| Type | Description |
|---|---|
RuntimeError
|
If the manifest has no blueprint. |
KeyError
|
If any referenced entry is missing from the routed pool. |
memorize(*, pool_nickname=None, pool_id=None, batch_size=128)
¶
Upload all referenced entries and store the manifest's blueprint.
Collects any pending Entry objects provided at construction time,
uploads them in batches, then stores the manifest itself (whose
payload is the blueprint dict).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
pool_nickname
|
str
|
Pool alias to route entries to. Defaults to the alpha pool. |
None
|
pool_id
|
str
|
Explicit pool |
None
|
batch_size
|
int
|
Maximum entries per upload batch. |
128
|
Returns:
| Type | Description |
|---|---|
GroupFuture
|
Tracks all writes (leaf entries + manifest itself). |
Source code in policy/central/memory/schema/manifest.py
remember(*, pool_nickname=None, pool_id=None, batch_size=128)
¶
Recall all referenced entries from the pool.
Collects every leaf global_id from the blueprint, fetches them
in batches via laila.remember().
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
pool_nickname
|
str
|
Pool alias to read from. Defaults to the alpha pool. |
None
|
pool_id
|
str
|
Explicit pool |
None
|
batch_size
|
int
|
Maximum entries per recall batch. |
128
|
Returns:
| Type | Description |
|---|---|
GroupFuture
|
Child futures resolve to the recalled |
Source code in policy/central/memory/schema/manifest.py
forget(*, pool_nickname=None, pool_id=None, batch_size=128)
¶
Delete all referenced entries and the manifest itself from the pool.
Collects every leaf global_id plus the manifest's own
global_id, deletes them in batches via laila.forget().
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
pool_nickname
|
str
|
Pool alias to delete from. Defaults to the alpha pool. |
None
|
pool_id
|
str
|
Explicit pool |
None
|
batch_size
|
int
|
Maximum entries per deletion batch. |
128
|
Returns:
| Type | Description |
|---|---|
GroupFuture
|
Tracks all deletions (leaf entries + manifest itself). |
Source code in policy/central/memory/schema/manifest.py
serialize(transformations=None, *, exclude_private=None)
¶
Serialize the manifest, excluding transient _pending_entries.
Source code in policy/central/memory/schema/manifest.py
recover(in_dict, notify_on_creation=False)
classmethod
¶
Reconstruct a Manifest from a serialised dict or JSON string.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
in_dict
|
dict or str or Manifest
|
Serialised representation produced by |
required |
notify_on_creation
|
bool
|
If |
False
|
Returns:
| Type | Description |
|---|---|
Manifest
|
The recovered Manifest instance. |
Source code in policy/central/memory/schema/manifest.py
keys()
¶
values()
¶
items()
¶
sub_manifest(keys)
¶
Return a new Manifest containing only the specified top-level keys.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
keys
|
list[str]
|
Top-level blueprint keys to include in the sub-manifest. |
required |
Returns:
| Type | Description |
|---|---|
Manifest
|
A new manifest whose blueprint is the subset of this manifest's blueprint restricted to keys. |
Raises:
| Type | Description |
|---|---|
RuntimeError
|
If the manifest has no blueprint. |
KeyError
|
If any key in keys is not present in the blueprint. |
Source code in policy/central/memory/schema/manifest.py
extend(other, *, overwrite=False)
¶
Merge another manifest's blueprint into this one in-place.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
other
|
Manifest
|
The manifest whose top-level keys will be added. |
required |
overwrite
|
bool
|
If |
False
|
Raises:
| Type | Description |
|---|---|
TypeError
|
If other is not a |
KeyError
|
If overwrite is |
Source code in policy/central/memory/schema/manifest.py
__iadd__(other)
¶
manifest += other — merge other in-place and return self.
__add__(other)
¶
manifest + other — return a new manifest with merged blueprints.
Source code in policy/central/memory/schema/manifest.py
__getitem__(key)
¶
__len__()
¶
__iter__()
¶
Yield every global_id string via a depth-first, insertion-order walk.
__contains__(global_id)
¶
Return True if global_id appears anywhere in the blueprint leaves.
Source code in policy/central/memory/schema/manifest.py
PythonThreadPoolTaskForce
¶
Bases: _LAILA_IDENTIFIABLE_TASK_FORCE
Thread-pool TaskForce implementation.
Inherits shared queue management, len()/queue_len, and lifecycle surface
(start, pause, shutdown) from the base TaskForce.
This subclass implements the backend-specific hooks using a
ThreadPoolExecutor and dispatcher thread to consume items from _q.
Source code in policy/central/command/taskforce/thread_pool_executor/taskforce.py
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 | |
imap(tasks)
¶
Submit an iterable of zero-arg callables, yielding future identities in submission order.
Source code in policy/central/command/taskforce/thread_pool_executor/taskforce.py
submit(tasks, wait=False)
¶
Batch submit zero-arg callables.
Returns future identities (single) or a hollow GroupFuture (multiple) when wait is False. When wait is True, blocks and returns values.
Source code in policy/central/command/taskforce/thread_pool_executor/taskforce.py
future
¶
Bases: _LAILA_IDENTIFIABLE_FUTURE
Abstract Future base class with identity, outcome, and callbacks.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
future_identity
|
Identity metadata for this Future instance. |
required |
Source code in policy/central/command/schema/future/future/future.py
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 | |
status
property
writable
¶
Return the current status code for this Future.
result
property
writable
¶
Return the current result value. Releases the lock before waiting to avoid deadlock with the done callback that sets the result.
data
property
¶
Return the unwrapped payload of the result Entry.
Raises:
| Type | Description |
|---|---|
RuntimeError
|
If the result is not an Entry instance. |
exception
property
writable
¶
Return the current exception value.
future_identity
property
¶
Return a lightweight identity handle for this future.
model_post_init(__context)
¶
Wire default callbacks and register this future with the active policy.
Source code in policy/central/command/schema/future/future/future.py
add_callback(status, fn)
¶
Register a callback for a specific status transition.
remove_callback(status, fn)
¶
clear_callbacks(status)
¶
clear_all_callbacks()
¶
trigger_callback(status)
¶
Trigger the callback for the given status, if present.
wait(timeout=None)
¶
Block until the future completes. Subclasses must override.
Source code in policy/central/command/schema/future/future/future.py
finished()
¶
cancelled()
¶
error()
¶
not_started()
¶
manifest
¶
Bases: Entry
Entry subclass wrapping a nested dict of global_id references.
A manifest maps user-defined string keys to global_id strings, lists
of global_id strings, or recursively nested dicts following the same
rules. It can be constructed from raw ID strings or from Entry
objects.
The manifest's .data IS the blueprint dict. It carries scope
MANIFEST and evolution None (constant).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
dict
|
A nested dict whose leaves are |
{}
|
uuid
|
str
|
Explicit UUID for the manifest's own identity. |
required |
nickname
|
str
|
Human-readable name converted to a deterministic UUID. |
required |
global_id
|
str
|
Composite identifier used to set identity. |
required |
Source code in policy/central/memory/schema/manifest.py
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 | |
blueprint
property
¶
The nested dict with global_id strings as leaf values.
resolved
property
¶
Synchronously fetch all referenced entries through central memory.
Walks the blueprint, recalls each entry via the memory layer's
remember path (routing, deserialization, etc.), and returns a
nested dict of Entry objects mirroring the blueprint structure.
No caching — each access re-fetches.
Raises:
| Type | Description |
|---|---|
RuntimeError
|
If the manifest has no blueprint. |
KeyError
|
If any referenced entry is missing from the routed pool. |
memorize(*, pool_nickname=None, pool_id=None, batch_size=128)
¶
Upload all referenced entries and store the manifest's blueprint.
Collects any pending Entry objects provided at construction time,
uploads them in batches, then stores the manifest itself (whose
payload is the blueprint dict).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
pool_nickname
|
str
|
Pool alias to route entries to. Defaults to the alpha pool. |
None
|
pool_id
|
str
|
Explicit pool |
None
|
batch_size
|
int
|
Maximum entries per upload batch. |
128
|
Returns:
| Type | Description |
|---|---|
GroupFuture
|
Tracks all writes (leaf entries + manifest itself). |
Source code in policy/central/memory/schema/manifest.py
remember(*, pool_nickname=None, pool_id=None, batch_size=128)
¶
Recall all referenced entries from the pool.
Collects every leaf global_id from the blueprint, fetches them
in batches via laila.remember().
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
pool_nickname
|
str
|
Pool alias to read from. Defaults to the alpha pool. |
None
|
pool_id
|
str
|
Explicit pool |
None
|
batch_size
|
int
|
Maximum entries per recall batch. |
128
|
Returns:
| Type | Description |
|---|---|
GroupFuture
|
Child futures resolve to the recalled |
Source code in policy/central/memory/schema/manifest.py
forget(*, pool_nickname=None, pool_id=None, batch_size=128)
¶
Delete all referenced entries and the manifest itself from the pool.
Collects every leaf global_id plus the manifest's own
global_id, deletes them in batches via laila.forget().
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
pool_nickname
|
str
|
Pool alias to delete from. Defaults to the alpha pool. |
None
|
pool_id
|
str
|
Explicit pool |
None
|
batch_size
|
int
|
Maximum entries per deletion batch. |
128
|
Returns:
| Type | Description |
|---|---|
GroupFuture
|
Tracks all deletions (leaf entries + manifest itself). |
Source code in policy/central/memory/schema/manifest.py
serialize(transformations=None, *, exclude_private=None)
¶
Serialize the manifest, excluding transient _pending_entries.
Source code in policy/central/memory/schema/manifest.py
recover(in_dict, notify_on_creation=False)
classmethod
¶
Reconstruct a Manifest from a serialised dict or JSON string.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
in_dict
|
dict or str or Manifest
|
Serialised representation produced by |
required |
notify_on_creation
|
bool
|
If |
False
|
Returns:
| Type | Description |
|---|---|
Manifest
|
The recovered Manifest instance. |
Source code in policy/central/memory/schema/manifest.py
keys()
¶
values()
¶
items()
¶
sub_manifest(keys)
¶
Return a new Manifest containing only the specified top-level keys.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
keys
|
list[str]
|
Top-level blueprint keys to include in the sub-manifest. |
required |
Returns:
| Type | Description |
|---|---|
Manifest
|
A new manifest whose blueprint is the subset of this manifest's blueprint restricted to keys. |
Raises:
| Type | Description |
|---|---|
RuntimeError
|
If the manifest has no blueprint. |
KeyError
|
If any key in keys is not present in the blueprint. |
Source code in policy/central/memory/schema/manifest.py
extend(other, *, overwrite=False)
¶
Merge another manifest's blueprint into this one in-place.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
other
|
Manifest
|
The manifest whose top-level keys will be added. |
required |
overwrite
|
bool
|
If |
False
|
Raises:
| Type | Description |
|---|---|
TypeError
|
If other is not a |
KeyError
|
If overwrite is |
Source code in policy/central/memory/schema/manifest.py
__iadd__(other)
¶
manifest += other — merge other in-place and return self.
__add__(other)
¶
manifest + other — return a new manifest with merged blueprints.
Source code in policy/central/memory/schema/manifest.py
__getitem__(key)
¶
__len__()
¶
__iter__()
¶
Yield every global_id string via a depth-first, insertion-order walk.
__contains__(global_id)
¶
Return True if global_id appears anywhere in the blueprint leaves.
Source code in policy/central/memory/schema/manifest.py
__resolve_nickname(kwargs)
¶
Convert a nickname in kwargs to a deterministic global_id list.
activate_policy(policy)
¶
Replace the active policy singleton.
Accepts a local _LAILA_IDENTIFIABLE_POLICY or a
RemotePolicyProxy obtained from laila.peers.
Equivalent to laila.active_policy = policy.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
policy
|
_LAILA_IDENTIFIABLE_POLICY | RemotePolicyProxy
|
The policy instance (local or remote proxy) to activate globally. |
required |
add_peer(uri, secret)
¶
Connect to a remote policy and register it as a peer.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
uri
|
str
|
URI of the remote policy (e.g. |
required |
secret
|
str
|
The remote policy's |
required |
Returns:
| Type | Description |
|---|---|
str
|
The |
constant(cls, data, *, global_id=None, uuid=None, nickname=None)
classmethod
¶
Create an immutable Entry (evolution is None).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
Any
|
The raw payload. |
required |
global_id
|
str
|
Composite identifier (must not contain an evolution component). |
None
|
uuid
|
str
|
Explicit UUID. Mutually exclusive with global_id. |
None
|
nickname
|
str
|
Human-readable name used to derive a deterministic UUID. |
None
|
Returns:
| Type | Description |
|---|---|
Entry
|
A new constant Entry. |
Raises:
| Type | Description |
|---|---|
RuntimeError
|
If conflicting identity arguments are provided or the global_id includes an evolution component. |
Source code in entry/entry.py
contingent(cls, **kwargs)
classmethod
¶
Create an Entry from raw keyword arguments without validation guards.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
**kwargs
|
Forwarded directly to the |
{}
|
Returns:
| Type | Description |
|---|---|
Entry
|
|
Source code in entry/entry.py
forget(*args, **kwargs)
¶
Delete one or more entries from the active policy's memory.
Removes the stored blob from the routed pool. Returns a future that resolves when the deletion completes.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
entry_ids
|
str | list[str]
|
The |
required |
pool_id
|
str
|
Explicit pool |
required |
pool_nickname
|
str
|
Pool alias registered via |
required |
nickname
|
str
|
Convenience alias – converted to a deterministic |
required |
get_active_namespace()
¶
Return the active UUID namespace, initializing it on first access.
get_active_policy()
¶
Return the active policy, lazily creating a DefaultPolicy on first access.
memorize(*args, **kwargs)
¶
Persist one or more entries into the active policy's memory.
Entries are serialized, transformed, and written to the routed pool.
Returns a future (or GroupFuture) that resolves when the write
completes. Returns None when the default in-memory pool is used.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
entries
|
Entry | list[Entry]
|
The entry or entries to store. |
required |
pool_id
|
str
|
Explicit pool |
required |
pool_nickname
|
str
|
Pool alias registered via |
required |
read_args(source, *, terminal_args=None)
¶
Load user arguments from a TOML/JSON/.env/.xml file or terminal into laila.args.
Mutates laila.args in place. Always returns None.
remember(*args, **kwargs)
¶
Retrieve one or more entries from the active policy's memory.
Reads serialized blobs from the routed pool, applies the inverse
transformation sequence, and returns recovered Entry objects
wrapped in a future.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
entry_ids
|
str | list[str]
|
The |
required |
pool_id
|
str
|
Explicit pool |
required |
pool_nickname
|
str
|
Pool alias registered via |
required |
nickname
|
str
|
Convenience alias – converted to a deterministic |
required |
set_active_namespace(namespace_key)
¶
Set the active UUID namespace derived from namespace_key.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
namespace_key
|
str
|
DNS-style key used with |
required |
set_default_directory(directory)
¶
Override the default root directory and derived sub-directories.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
directory
|
str
|
Filesystem path (may contain |
required |
status(future_ref)
¶
Return the status of a future.
.. deprecated::
Use laila.runtime.status() instead.
variable(cls, data, *, uuid=None, evolution=None, state=None, constitution=None, global_id=None, nickname=None)
classmethod
¶
Create a mutable (evolvable) Entry.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
Any
|
The raw payload. |
required |
uuid
|
str
|
Explicit UUID. Mutually exclusive with global_id. |
None
|
evolution
|
int
|
Starting evolution counter (defaults to |
None
|
state
|
EntryState
|
Initial state; auto-set to |
None
|
constitution
|
callable
|
Not yet implemented. |
None
|
global_id
|
str
|
Composite |
None
|
nickname
|
str
|
Human-readable name used to derive a deterministic UUID. |
None
|
Returns:
| Type | Description |
|---|---|
Entry
|
A new variable Entry. |
Raises:
| Type | Description |
|---|---|
RuntimeError
|
If conflicting identity arguments are provided or both constitution and data are set. |
NotImplementedError
|
If a constitution is supplied. |
Source code in entry/entry.py
wait(future_ref, timeout=None)
¶
Block until the future completes and return its result.
.. deprecated::
Use laila.runtime.wait() instead.