Server¶
FastAPI server implementation for the aspyx service framework.
FastAPIServer(fast_api, service_manager, component_registry, protobuf_manager)
¶
Bases: Server
A server utilizing fastapi framework.
add_routes()
¶
add everything that looks like an http endpoint
boot(module, host='0.0.0.0', port=8000, start_thread=True)
classmethod
¶
boot the DI infrastructure of the supplied module and optionally start a fastapi thread given the url Args: module: the module to initialize the environment host: listen address port: the port
Returns:
Type | Description |
---|---|
Environment
|
the created environment |
start_server(host)
¶
start the fastapi server in a thread
health checks
HealthCheckManager()
¶
The health manager is able to run all registered health checks and is able to return an overall status.
check()
async
¶
run all registered health checks and return an overall result. Returns: the overall result.
HealthStatus
¶
Bases: Enum
A enum specifying the health status of a service. The values are:
OK
service is healthyWARNING
service has some problemsCRITICAL
service is unhealthy
health_check(name='', cache=0, fail_if_slower_than=0)
¶
Methods annotated with @health_check
specify health checks that will be executed.
health_checks()
¶
Instances of classes that are annotated with @health_checks contain healt mehtods.