faust-streaming / faust

Python Stream Processing. A Faust fork
https://faust-streaming.github.io/faust/
Other
1.65k stars 183 forks source link

Could you please extend the setting of the webserver to pass parameters? #551

Open cmartmos opened 1 year ago

cmartmos commented 1 year ago

Checklist

Steps to reproduce

I am required to pass some parameters to the aiohttp application directly (e.g. middleware, client_max_size, ...) to extend the worker API. However, it's not possible in the actual implementation of the aiohttp driver.

Could you please extend the setting or the aiohttp driver to overcome this limitation?

Expected behavior

Support for web server parameters

Actual behavior

Not supported

Full traceback

# faust/web/drivers/aiohttp.py

class Web(base.Web):

    def __init__(self, app: AppT, **kwargs: Any) -> None:
        super().__init__(app, **kwargs)

        self.web_app: Application = Application()   # <------- EXTEND WITH KWARGS

        self.cors_options = _prepare_cors_options(app.conf.web_cors_options or {})
        self._runner: AppRunner = AppRunner(self.web_app, access_log=None)
        self._transport_handlers = {
            "tcp": self._new_transport_tcp,
            "unix": self._new_transport_unix,
        }

Versions

dada-engineer commented 1 year ago

This is not that easy as we do run all the components as mode.Service instances. The first line in __init__ does exactly this, and the aiohttp.Application kwargs wouldn't be allowed in mode.Service.

What we could do though is to allow web_driver_args params in creation that could then be thrown into this.