unitelabs.cdk
Packages
Attributes
- Name
__version__
- Type
- Value
= version('unitelabs_cdk')
- Description
- Name
__all__
- Type
- Value
= [ "__version__", "Connector", "Config", "create_logger", "compose_app", "AppFactory" ]
- Description
- Name
AppFactory
- Type
- Value
= collections.abc.Callable[..., typing.Union[Connector, collections.abc.Awaitable[Connector], Generator]]
- Description
Functions
create_logger(name : str, level : logging._Level) -> logging.Logger
Get the app's logger and configure it if needed.
Parameters
- Name
name
- Type
- str
- Default
- = __package__
- Description
- Name
level
- Type
- logging._Level
- Default
- = logging.INFO
- Description
Response
- Type
- logging.Logger
- Description
Classes
Config
- Bases
- pydantic_settings.BaseSettings
Attributes
- Name
model_config
- Type
- Value
= SettingsConfigDict(env_file='.env', env_file_encoding='utf-8', env_nested_delimiter='__', extra='ignore')
- Description
- Name
environment
- Type
- str
- Value
= 'development'
- Description
- Name
sila_server
- Type
- sila.server.ServerConfig
- Value
= server.ServerConfig()
- Description
- Name
cloud_server_endpoint
- Type
- sila.cloud_connector.CloudServerEndpointConfig
- Value
= cloud_connector.CloudServerEndpointConfig()
- Description
Connector
Main app
Methods
__init__(self, config : typing.Optional[dict]) -> None
Parameters
- Name
self
- Type
- Default
- Description
- Name
config
- Type
- typing.Optional[dict]
- Default
- = None
- Description
register(self, feature : sila.server.Feature) -> None
Register a new feature to this driver
Parameters
- Name
self
- Type
- Default
- Description
- Name
feature
- Type
- sila.server.Feature
- Default
- Description
start(self) -> None
Start the connector and all related services.
close(self) -> None
Close the connector and all related services.
on_shutdown(self, handler : Handler) -> None
Add a shutdown hook to be called in the terminating phase (in response to an explicit call to `app.close()` or upon receipt of system signals such as SIGINT or SIGTERM).
Parameters
- Name
self
- Type
- Default
- Description
- Name
handler
- Type
- Handler
- Default
- Description
The method to be called on shutdown.
Exceptions
- Type
- TypeError
- Description
- If the `handler` argument is not callable.
Attributes
- Name
__config
- Type
- Value
= Config.parse_obj(config or {})
- Description
- Name
_shutdown_handlers
- Type
- list[Handler]
- Value
= []
- Description
- Name
_sila_server
- Type
- Value
= server.Server(config=self.config.sila_server)
- Description
- Name
_broadcaster
- Type
- Value
= discovery.Broadcaster(self._sila_server)
- Description
- Name
_cloud_server_endpoint
- Type
- Value
= cloud_connector.CloudServerEndpoint(self._sila_server, self.config.cloud_server_endpoint)
- Description
- Name
config
- Type
- Config
- Value
= None
- Description
- Name
sila_server
- Type
- sila.server.Server
- Value
= None
- Description
- Name
logger
- Type
- logging.Logger
- Value
= None
- Description
class:`~logging.Logger` for the app.
- Name
debug
- Type
- bool
- Value
= None
- Description
Whether debug mode is enabled.