robonix_api.result

Lifecycle handler return type.

Every @<provider>.on_init / on_activate / on_deactivate / on_shutdown handler MUST return one of Ok / Err / Deferred. Only on_init receives cfg: dict (the CMD_INIT config_json, JSON-decoded); the other three take no args. Don’t raise — the framework will catch and convert raises into Err(repr(exc)) defensively but logs a warning telling you to use Err(…) explicitly instead.

Ok() — handler succeeded; framework advances state. Err(”…”) — handler failed; provider goes to ERROR. Deferred(”…”) — handler can’t proceed yet; provider stays in

current state. v0.1 reports the reason to the operator and moves on (no deferred queue).

Classes

Deferred(reason)

Handler can't proceed yet — typically waiting for an upstream provider to come online, a sensor to publish first message, etc.

Err(message)

Handler failed.

Ok()

Handler succeeded.

class robonix_api.result.Deferred(reason: str)[source]

Bases: object

Handler can’t proceed yet — typically waiting for an upstream provider to come online, a sensor to publish first message, etc. The provider stays in its current state; framework expects the operator or eviction policy to retry later. reason is shown in rbnx caps.

reason: str
class robonix_api.result.Err(message: str)[source]

Bases: object

Handler failed. message shows up in rbnx caps state_detail and atlas’s logs. Use this for both expected failures (config invalid, dependency missing) and caught exceptions.

message: str
class robonix_api.result.Ok[source]

Bases: object

Handler succeeded. Carries no payload — the lifecycle framework advances state based on which CMD_* the handler ran on, not on the return value.