Skip to content

Commit 1056e6a

Browse files
author
Andrei Neagu
committed
made names better
1 parent 157004d commit 1056e6a

File tree

6 files changed

+19
-19
lines changed

6 files changed

+19
-19
lines changed

packages/service-library/src/servicelib/fastapi/docker.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
_DOCKER_API_PROXY_SETTINGS: Final[str] = "docker_api_proxy_settings"
2222

2323

24-
def get_remote_docker_client_main_lifespan(settings: DockerApiProxysettings) -> State:
24+
def create_remote_docker_client_input_state(settings: DockerApiProxysettings) -> State:
2525
return {_DOCKER_API_PROXY_SETTINGS: settings}
2626

2727

packages/service-library/src/servicelib/fastapi/postgres_lifespan.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class PostgresConfigurationError(LifespanOnStartupError):
2323
msg_template = "Invalid postgres settings [={settings}] on startup. Note that postgres cannot be disabled using settings"
2424

2525

26-
def get_postgres_database_main_lifespan(settings: PostgresSettings) -> State:
26+
def create_postgres_database_input_state(settings: PostgresSettings) -> State:
2727
return {PostgresLifespanState.POSTGRES_SETTINGS: settings}
2828

2929

packages/service-library/src/servicelib/fastapi/prometheus_instrumentation.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ def _on_shutdown() -> None:
5757
_PROMETHEUS_INSTRUMENTATION_ENABLED: Final[str] = "prometheus_instrumentation_enabled"
5858

5959

60-
def get_prometheus_instrumentationmain_main_lifespan(*, enabled: bool) -> State:
60+
def create_prometheus_instrumentationmain_input_state(*, enabled: bool) -> State:
6161
return {_PROMETHEUS_INSTRUMENTATION_ENABLED: enabled}
6262

6363

services/catalog/src/simcore_service_catalog/core/events.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@
44
from fastapi import FastAPI
55
from fastapi_lifespan_manager import LifespanManager, State
66
from servicelib.fastapi.postgres_lifespan import (
7-
get_postgres_database_main_lifespan,
7+
create_postgres_database_input_state,
88
postgres_database_lifespan,
99
)
1010
from servicelib.fastapi.prometheus_instrumentation import (
11-
get_prometheus_instrumentationmain_main_lifespan,
11+
create_prometheus_instrumentationmain_input_state,
1212
prometheus_instrumentation_lifespan,
1313
)
1414

@@ -40,12 +40,12 @@ async def _banners_lifespan(_) -> AsyncIterator[State]:
4040
_flush_finished_banner()
4141

4242

43-
async def _main_lifespan(app: FastAPI) -> AsyncIterator[State]:
43+
async def _settings_lifespan(app: FastAPI) -> AsyncIterator[State]:
4444
settings: ApplicationSettings = app.state.settings
4545

4646
yield {
47-
**get_postgres_database_main_lifespan(settings.CATALOG_POSTGRES),
48-
**get_prometheus_instrumentationmain_main_lifespan(
47+
**create_postgres_database_input_state(settings.CATALOG_POSTGRES),
48+
**create_prometheus_instrumentationmain_input_state(
4949
enabled=settings.CATALOG_PROMETHEUS_INSTRUMENTATION_ENABLED
5050
),
5151
}
@@ -54,7 +54,7 @@ async def _main_lifespan(app: FastAPI) -> AsyncIterator[State]:
5454
def create_app_lifespan() -> LifespanManager:
5555
# WARNING: order matters
5656
app_lifespan = LifespanManager()
57-
app_lifespan.add(_main_lifespan)
57+
app_lifespan.add(_settings_lifespan)
5858

5959
# - postgres
6060
app_lifespan.add(postgres_database_lifespan)

services/docker-api-proxy/tests/integration/conftest.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
from pydantic import Field
1313
from pytest_simcore.helpers.monkeypatch_envs import EnvVarsDict, setenvs_from_dict
1414
from servicelib.fastapi.docker import (
15+
create_remote_docker_client_input_state,
1516
get_remote_docker_client,
16-
get_remote_docker_client_main_lifespan,
1717
remote_docker_client_lifespan,
1818
)
1919
from settings_library.application import BaseApplicationSettings
@@ -40,19 +40,19 @@ class ApplicationSetting(BaseApplicationSettings):
4040
]
4141

4242

43-
async def _main_lifespan(app: FastAPI) -> AsyncIterator[State]:
43+
async def _settings_lifespan(app: FastAPI) -> AsyncIterator[State]:
4444
settings: ApplicationSetting = app.state.settings
4545

4646
yield {
47-
**get_remote_docker_client_main_lifespan(settings.DOCKER_API_PROXY),
47+
**create_remote_docker_client_input_state(settings.DOCKER_API_PROXY),
4848
}
4949

5050

5151
def _get_test_app() -> FastAPI:
5252
settings = ApplicationSetting.create_from_envs()
5353

5454
lifespan_manager = LifespanManager()
55-
lifespan_manager.add(_main_lifespan)
55+
lifespan_manager.add(_settings_lifespan)
5656
lifespan_manager.add(remote_docker_client_lifespan)
5757

5858
app = FastAPI(lifespan=lifespan_manager)

services/dynamic-scheduler/src/simcore_service_dynamic_scheduler/core/events.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33
from fastapi import FastAPI
44
from fastapi_lifespan_manager import LifespanManager, State
55
from servicelib.fastapi.docker import (
6-
get_remote_docker_client_main_lifespan,
6+
create_remote_docker_client_input_state,
77
remote_docker_client_lifespan,
88
)
99
from servicelib.fastapi.prometheus_instrumentation import (
10-
get_prometheus_instrumentationmain_main_lifespan,
10+
create_prometheus_instrumentationmain_input_state,
1111
prometheus_instrumentation_lifespan,
1212
)
1313

@@ -32,22 +32,22 @@ async def _banner_lifespan(app: FastAPI) -> AsyncIterator[State]:
3232
print(APP_FINISHED_BANNER_MSG, flush=True) # noqa: T201
3333

3434

35-
async def _main_lifespan(app: FastAPI) -> AsyncIterator[State]:
35+
async def _settings_lifespan(app: FastAPI) -> AsyncIterator[State]:
3636
settings: ApplicationSettings = app.state.settings
3737

3838
yield {
39-
**get_prometheus_instrumentationmain_main_lifespan(
39+
**create_prometheus_instrumentationmain_input_state(
4040
enabled=settings.DYNAMIC_SCHEDULER_PROMETHEUS_INSTRUMENTATION_ENABLED
4141
),
42-
**get_remote_docker_client_main_lifespan(
42+
**create_remote_docker_client_input_state(
4343
settings.DYNAMIC_SCHEDULER_DOCKER_API_PROXY
4444
),
4545
}
4646

4747

4848
def create_app_lifespan() -> LifespanManager:
4949
app_lifespan = LifespanManager()
50-
app_lifespan.add(_main_lifespan)
50+
app_lifespan.add(_settings_lifespan)
5151

5252
app_lifespan.add(director_v2_lifespan)
5353
app_lifespan.add(director_v0_lifespan)

0 commit comments

Comments
 (0)