Rest Gateway

class forml.provider.gateway.rest.Gateway(inventory: asset.Inventory | None = None, registry: asset.Registry | None = None, feeds: io.Importer | None = None, processes: int | None = None, loop: asyncio.AbstractEventLoop | None = None, server: collections.abc.Callable[[applications.Starlette, ...], None] = uvicorn.run, **options)[source]

Bases: Gateway

Serving gateway implemented as a RESTful API.

The frontend provides the following HTTP endpoints:

Path

Method

Description

/stats

GET

Retrieve the Engine-provided performance metrics report.

/<application>

POST

Prediction request for the given application. The entire request body is passed to the Engine as the layout.Request.payload with the declared content-type indicated via the .encoding and any potential query parameters bundled within the .params.

Parameters:
inventory: asset.Inventory | None = None

Inventory of applications to be served (default as per the platform configuration).

registry: asset.Registry | None = None

Model registry of project artifacts to be served (default as per the platform configuration).

feeds: io.Importer | None = None

Feeds to be used for potential feature augmentation (default as per the platform configuration).

processes: int | None = None

Process pool size for each model sandbox.

loop: asyncio.AbstractEventLoop | None = None

Explicit event loop instance.

server: collections.abc.Callable[[applications.Starlette, ...], None] = uvicorn.run

Serving loop main function accepting the provided application instance (defaults to uvicorn.run).

**options

Additional serving loop keyword arguments (i.e. Uvicorn settings).

The provider can be enabled using the following platform configuration:

config.toml
 [GATEWAY.http]
 provider = "rest"
 port = 8080
 processes = 3

Important

Select the rest extras to install ForML together with the Starlette/Uvicorn support.