-
Notifications
You must be signed in to change notification settings - Fork 2
API Reference
mirazola-ik edited this page Dec 9, 2025
·
5 revisions
It documents the public application entry points and the internal modules used by the Serverless Runtime.
The FastAPI application is defined in app/main.py and configures logging, Prometheus metrics, and RabbitMQ consumer startup (when run directly).
-
GET /: Returns a string with the main route hint. -
POST /control/stop-consuming: Gracefully stops the RabbitMQ consumer if running. -
Router prefix /v1/faas: Additional FaaS endpoints provided byfaas_routerinapp/api/v1/faas.py.
- Initializes Prometheus metrics and starts a metrics HTTP server on port
9100. - Integrates Uvicorn logging with the custom
CognitLogger(app/modules/_logger.py). - When executed directly (
python app/main.py):- Starts a
RabbitMQClient(app/modules/_rabbitmq_client.py) in a background thread. - Runs Uvicorn with host/port arguments.
- Starts a
-
--host(default127.0.0.1): API host address. -
--flavour(required): RabbitMQ queue name. Must match an existing FLAVOUR within the COGNIT framework. -
--broker(required): RabbitMQ broker address. -
--port(default8000): API server port.
Internal modules are located under app/modules/ and implement logging, execution, parsing, storage, and messaging.
-
_logger.py:CognitLoggerproviding structured logging used across the runtime and integrated with Uvicorn. -
_executor.py: Base execution logic for running offloaded functions (supports Python and C paths). -
_pyexec.py: Extends the base executor with Python-specific execution behaviour. -
_faas_parser.py: Serialization/deserialization of offloaded functions and returned results. -
_minio_client.py: Client utilities for CRUD operations against MinIO. -
_rabbitmq_client.py: RabbitMQ producer/consumer used to communicate with the Edge Cluster broker.
Defined under app/api/v1/:
-
faas.py: Declaresfaas_routerand exports Prometheus metrics and collectors consumed bymain.py. -
nano_pb2.py/nanopb_pb2.py: Protocol Buffer-related modules used for message or payload structures.
Defined under app/models/:
-
faas.py: FaaS request/response data structures and internal communication models between function calls. -
daas.py: DaaS-related models complementing FaaS flows.
Located under app/test/:
-
test_faas.py,test_pyexec.py,test_cexec.py,test_rabbitmq_client.py: Unit tests validating API and core module behaviours.
-
app/entrypoint.sh: Shell entrypoint for container or runtime startup sequencing.