adapter_common#
- class ActionModulePlugin#
- add_module(
- module: ActionModule,
- abstract async setup(
- pctx: PluginContext,
- class PluginContext(*args, **kwargs)#
- abstract property alabPyBase: AlabPyBase#
Deprecated. Use AlabPyBase.from_config() instead.
- abstract property artificial_api: ArtificialApi#
Artificial API methods.
- abstract property assetStateReporter: AssetReporter#
Deprecated. Use lab.assets API instead.
- abstract asset_sync_manager_v1( ) AssetSyncApiV1 #
Asset Sync Manager Instance.
- abstract property config: AdapterProgramConfig#
- abstract property experimental: ExperimentalApi#
Experimental API methods.
- abstract property gql_session: AutoReconnectingAsyncClientSession#
GraphQL session connected to the alab instance
- abstract property raw_config: Config#
- class ActionModule#
- property artificial_api: ArtificialApi#
Artificial API for an action module.
- static get_action_definitions(
- module: Type | ActionModule,
- classmethod get_name() str #
Only needed for python 3.8. In 3.9 the name property can be a classmethod.
- inject_plugin_ctx(
- plugin_ctx: PluginContext,
- property moduleRuntime: ActionModuleRuntime#
- property module_runtime: ActionModuleRuntime#
- property plugin_ctx: PluginContext#
Plugin context for an action module.
- class ActionExecutionContext(*args, **kwargs)#
- abstract property action: Action#
The protobuf message for this action.
- abstract property canceled: bool#
True if this action has been canceled and should terminate as soon as possible.
- abstract getRestoreData() str | None #
Return a previously stored restoreData if an instance of this action has not completed and the Adapter has restarted. Otherwise returns None and this is a fresh start of this action. If an action should be restorable, call this in the beginning of your action to switch between fresh start and restart.
- abstract get_restore_data() str | None #
Return a previously stored restoreData if an instance of this action has not completed and the Adapter has restarted. Otherwise returns None and this is a fresh start of this action. If an action should be restorable, call this in the beginning of your action to switch between fresh start and restart.
- abstract property moduleRuntime: ActionModuleRuntime#
Deprecated: Return the ActionModuleRuntime this ActionContext is related to.
- abstract property module_runtime: ActionModuleRuntime#
Return the ActionModuleRuntime this ActionContext is related to.
- abstract observe_finish( ) None #
Spawn a task that waits for the given future to finish and then reports back completion or failure as the result of this action.
- abstract persistRestoreData(restoreData: str) None #
Persist data to restore and continue this action after an Adapter restart.
- abstract async persist_restore_data(restore_data: str) None #
Persist data to restore and continue this action after an Adapter restart.
- abstract async report_completed(
- result: Message,
Report that the action has completed successfully.
- abstract async report_failed(error: Exception) None #
Report that the action has failed with an error.
- abstract async report_paused(paused: bool) None #
Report that the action was paused or resumed externally
- abstract async restorable() None #
Mark an action as restorable. If restore data is saved, this is a no-op
- abstract setAbortHandler( ) None #
Set a handler to terminate this action as soon as possible. Note that this is different from asyncio task cancel which is used to shut down of the adapter and it is best to let a CancelledError throw.
- abstract set_abort_handler( ) None #
Set a handler to terminate this action as soon as possible. Note that this is different from asyncio task cancel which is used to shut down of the adapter and it is best to let a CancelledError throw.
- @action_modules(
- *module_types: Type[ActionModule],
- @ability_name(
- name: str,
Decorator for (Base)ActionModule to specify an ability name that applies to each of its @action methods.
- @action( ) Callable[[TCallable], TCallable] #
Decorator for an ActionModule method that is an action.
- class Health(*args, **kwargs)#
- Message#
alias of
HealthMessage
- abstract async add_monitor(
- id: str,
- callback: Callable[[], Coroutine[None, None, HealthMessage]],
- interval_s: float = 10.0,
- grace_s: float = 2.0,
Sets a health status monitor for a given id. The given callback will be regularly called and is expected to return within the configured grace period, otherwise the invocation is canceled. If the callback does not return in time or raises an error the state is considered to be in error.