File tree Expand file tree Collapse file tree 3 files changed +8
-17
lines changed
packages/service-library/src/servicelib/fastapi
docker-api-proxy/tests/integration
dynamic-scheduler/src/simcore_service_dynamic_scheduler/core Expand file tree Collapse file tree 3 files changed +8
-17
lines changed Original file line number Diff line number Diff line change 2020
2121
2222def get_lifespan_remote_docker_client (
23- docker_api_proxy_settings_property_name : str ,
23+ settings : DockerApiProxysettings ,
2424) -> LifespanGenerator :
25- """Ensures `setup` and `teardown` for the remote docker client.
26-
27- Arguments:
28- docker_api_proxy_settings_property_name -- if the name is `PROP_NAME`
29- then it should be accessible as `app.state.settings.PROP_NAME`
30-
31- Returns:
32- docker client lifespan manager
33- """
34-
3525 async def _ (app : FastAPI ) -> AsyncIterator [State ]:
36- settings : DockerApiProxysettings = getattr (
37- app .state .settings , docker_api_proxy_settings_property_name
38- )
3926
4027 session : ClientSession | None = None
4128 if settings .DOCKER_API_PROXY_USER and settings .DOCKER_API_PROXY_PASSWORD :
Original file line number Diff line number Diff line change @@ -39,12 +39,14 @@ class ApplicationSetting(BaseApplicationSettings):
3939 Field (json_schema_extra = {"auto_default_from_env" : True }),
4040 ]
4141
42+ settings = ApplicationSetting .create_from_envs ()
43+
4244 app = FastAPI (
4345 lifespan = combine_lifespans (
44- get_lifespan_remote_docker_client (" DOCKER_API_PROXY" )
46+ get_lifespan_remote_docker_client (settings . DOCKER_API_PROXY )
4547 )
4648 )
47- app .state .settings = ApplicationSetting . create_from_envs ()
49+ app .state .settings = settings
4850
4951 return app
5052
Original file line number Diff line number Diff line change @@ -55,7 +55,9 @@ def create_app(settings: ApplicationSettings | None = None) -> FastAPI:
5555 lifespan_service_tracker ,
5656 lifespan_deferred_manager ,
5757 lifespan_status_monitor ,
58- get_lifespan_remote_docker_client ("DYNAMIC_SCHEDULER_DOCKER_API_PROXY" ),
58+ get_lifespan_remote_docker_client (
59+ app_settings .DYNAMIC_SCHEDULER_DOCKER_API_PROXY
60+ ),
5961 ]
6062
6163 if app_settings .DYNAMIC_SCHEDULER_PROMETHEUS_INSTRUMENTATION_ENABLED :
You can’t perform that action at this time.
0 commit comments