Skip to content

Commit c130e8b

Browse files
author
Andrei Neagu
committed
renamed env var
1 parent f7e5863 commit c130e8b

File tree

5 files changed

+14
-21
lines changed

5 files changed

+14
-21
lines changed

.env-devel

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ DIRECTOR_V2_TRACING={}
126126
# DYNAMIC_SCHEDULER ----
127127
DYNAMIC_SCHEDULER_LOGLEVEL=DEBUG
128128
DYNAMIC_SCHEDULER_PROFILING=1
129-
DYNAMIC_SCHEDULER_SCHEDULING_MODE=VIA_DIRECTOR_V2
129+
DYNAMIC_SCHEDULER_USE_INTERNAL_SCHEDULER=0
130130
DYNAMIC_SCHEDULER_STOP_SERVICE_TIMEOUT=01:00:00
131131
DYNAMIC_SCHEDULER_TRACING={}
132132

services/docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -562,7 +562,7 @@ services:
562562
REDIS_PASSWORD: ${REDIS_PASSWORD}
563563
DIRECTOR_V2_HOST: ${DIRECTOR_V2_HOST}
564564
DIRECTOR_V2_PORT: ${DIRECTOR_V2_PORT}
565-
DYNAMIC_SCHEDULER_SCHEDULING_MODE: ${DYNAMIC_SCHEDULER_SCHEDULING_MODE}
565+
DYNAMIC_SCHEDULER_USE_INTERNAL_SCHEDULER: ${DYNAMIC_SCHEDULER_USE_INTERNAL_SCHEDULER}
566566
DYNAMIC_SCHEDULER_LOGLEVEL: ${DYNAMIC_SCHEDULER_LOGLEVEL}
567567
DYNAMIC_SCHEDULER_STOP_SERVICE_TIMEOUT: ${DYNAMIC_SCHEDULER_STOP_SERVICE_TIMEOUT}
568568
DYNAMIC_SCHEDULER_PROFILING: ${DYNAMIC_SCHEDULER_PROFILING}

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

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import datetime
2-
from enum import StrEnum
32
from typing import Annotated
43

54
from pydantic import AliasChoices, Field, TypeAdapter, field_validator
@@ -15,11 +14,6 @@
1514
from .._meta import API_VERSION, API_VTAG, PROJECT_NAME
1615

1716

18-
class SchedulingMode(StrEnum):
19-
INTERNAL = "INTERNAL"
20-
VIA_DIRECTOR_V2 = "VIA_DIRECTOR_V2"
21-
22-
2317
class _BaseApplicationSettings(BaseApplicationSettings, MixinLoggingSettings):
2418
"""Base settings of any osparc service's app"""
2519

@@ -74,8 +68,8 @@ class _BaseApplicationSettings(BaseApplicationSettings, MixinLoggingSettings):
7468
),
7569
)
7670

77-
DYNAMIC_SCHEDULER_SCHEDULING_MODE: SchedulingMode = Field(
78-
SchedulingMode.VIA_DIRECTOR_V2,
71+
DYNAMIC_SCHEDULER_USE_INTERNAL_SCHEDULER: bool = Field(
72+
default=False,
7973
description=(
8074
"this is a way to switch between different dynamic schedulers for the new style services"
8175
# NOTE: this option should be removed when the scheduling will be done via this service

services/dynamic-scheduler/src/simcore_service_dynamic_scheduler/services/scheduler_interface.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
from models_library.api_schemas_webserver.projects_nodes import NodeGet, NodeGetIdle
88
from models_library.projects_nodes_io import NodeID
99

10-
from ..core.settings import ApplicationSettings, SchedulingMode
10+
from ..core.settings import ApplicationSettings
1111
from .director_v2 import DirectorV2Client
1212
from .service_tracker import set_request_as_running, set_request_as_stopped
1313

@@ -16,7 +16,7 @@ async def get_service_status(
1616
app: FastAPI, *, node_id: NodeID
1717
) -> NodeGet | DynamicServiceGet | NodeGetIdle:
1818
settings: ApplicationSettings = app.state.settings
19-
if settings.DYNAMIC_SCHEDULER_SCHEDULING_MODE == SchedulingMode.INTERNAL:
19+
if settings.DYNAMIC_SCHEDULER_USE_INTERNAL_SCHEDULER:
2020
raise NotImplementedError
2121

2222
director_v2_client = DirectorV2Client.get_from_app_state(app)
@@ -30,7 +30,7 @@ async def run_dynamic_service(
3030
app: FastAPI, *, dynamic_service_start: DynamicServiceStart
3131
) -> NodeGet | DynamicServiceGet:
3232
settings: ApplicationSettings = app.state.settings
33-
if settings.DYNAMIC_SCHEDULER_SCHEDULING_MODE == SchedulingMode.INTERNAL:
33+
if settings.DYNAMIC_SCHEDULER_USE_INTERNAL_SCHEDULER:
3434
raise NotImplementedError
3535

3636
director_v2_client = DirectorV2Client.get_from_app_state(app)
@@ -46,7 +46,7 @@ async def stop_dynamic_service(
4646
app: FastAPI, *, dynamic_service_stop: DynamicServiceStop
4747
) -> None:
4848
settings: ApplicationSettings = app.state.settings
49-
if settings.DYNAMIC_SCHEDULER_SCHEDULING_MODE == SchedulingMode.INTERNAL:
49+
if settings.DYNAMIC_SCHEDULER_USE_INTERNAL_SCHEDULER:
5050
raise NotImplementedError
5151

5252
director_v2_client = DirectorV2Client.get_from_app_state(app)

services/dynamic-scheduler/tests/unit/api_rpc/test_api_rpc__services.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
)
3131
from settings_library.rabbit import RabbitSettings
3232
from settings_library.redis import RedisSettings
33-
from simcore_service_dynamic_scheduler.core.settings import SchedulingMode
3433

3534
pytest_simcore_core_services_selection = [
3635
"redis",
@@ -137,12 +136,12 @@ def mock_director_v2_service_state(
137136

138137
@pytest.fixture(
139138
params=[
140-
SchedulingMode.VIA_DIRECTOR_V2,
141-
# NOTE: enable below when INTERNAL scheduler is impelmented
142-
# SchedulingMode.INTERNAL,
139+
False,
140+
# NOTE: enable below when INTERNAL scheduler is implemented
141+
# True,
143142
]
144143
)
145-
def scheduling_mode(request: pytest.FixtureRequest) -> SchedulingMode:
144+
def use_internal_scheduler(request: pytest.FixtureRequest) -> bool:
146145
return request.param
147146

148147

@@ -151,13 +150,13 @@ def app_environment(
151150
app_environment: EnvVarsDict,
152151
rabbit_service: RabbitSettings,
153152
redis_service: RedisSettings,
154-
scheduling_mode: SchedulingMode,
153+
use_internal_scheduler: bool,
155154
monkeypatch: pytest.MonkeyPatch,
156155
) -> EnvVarsDict:
157156
setenvs_from_dict(
158157
monkeypatch,
159158
{
160-
"DYNAMIC_SCHEDULER_SCHEDULING_MODE": scheduling_mode,
159+
"DYNAMIC_SCHEDULER_USE_INTERNAL_SCHEDULER": f"{use_internal_scheduler}",
161160
},
162161
)
163162
return app_environment

0 commit comments

Comments
 (0)