Skip to content

Commit 0f91c3f

Browse files
committed
added new constant
1 parent 5d208e5 commit 0f91c3f

File tree

3 files changed

+24
-3
lines changed

3 files changed

+24
-3
lines changed

services/director-v2/src/simcore_service_director_v2/core/settings.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,14 @@ class ComputationalBackendSettings(BaseCustomSettings):
9999
),
100100
] = datetime.timedelta(minutes=10)
101101

102+
COMPUTATIONAL_BACKEND_MAX_WAITING_FOR_RETRIEVING_RESULTS: Annotated[
103+
datetime.timedelta,
104+
Field(
105+
description="maximum time the computational scheduler waits until retriving results from the computational backend is failed"
106+
"(default to seconds, or see https://pydantic-docs.helpmanual.io/usage/types/#datetime-types for string formatting)."
107+
),
108+
] = datetime.timedelta(minutes=10)
109+
102110
@cached_property
103111
def default_cluster(self) -> BaseCluster:
104112
return BaseCluster(

services/director-v2/tests/unit/with_dbs/comp_scheduler/conftest.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ def with_disabled_scheduler_publisher(mocker: MockerFixture) -> mock.Mock:
7373

7474

7575
@pytest.fixture
76-
def with_short_max_wait_for_clusters_keeper(
76+
def with_short_max_wait_for_cluster(
7777
monkeypatch: pytest.MonkeyPatch, mocker: MockerFixture
7878
) -> datetime.timedelta:
7979
short_time = datetime.timedelta(seconds=2)
@@ -82,3 +82,15 @@ def with_short_max_wait_for_clusters_keeper(
8282
{"COMPUTATIONAL_BACKEND_MAX_WAITING_FOR_CLUSTER_TIMEOUT": f"{short_time}"},
8383
)
8484
return short_time
85+
86+
87+
@pytest.fixture
88+
def with_short_max_wait_for_retrieving_results(
89+
monkeypatch: pytest.MonkeyPatch, mocker: MockerFixture
90+
) -> datetime.timedelta:
91+
short_time = datetime.timedelta(seconds=2)
92+
setenvs_from_dict(
93+
monkeypatch,
94+
{"COMPUTATIONAL_BACKEND_MAX_WAITING_FOR_RETRIEVING_RESULTS": f"{short_time}"},
95+
)
96+
return short_time

services/director-v2/tests/unit/with_dbs/comp_scheduler/test_scheduler_dask.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2064,7 +2064,7 @@ async def test_pipeline_with_on_demand_cluster_with_not_ready_backend_waits(
20642064
async def test_pipeline_with_on_demand_cluster_with_no_clusters_keeper_waits_and_eventually_timesout_fails(
20652065
with_disabled_auto_scheduling: mock.Mock,
20662066
with_disabled_scheduler_publisher: mock.Mock,
2067-
with_short_max_wait_for_clusters_keeper: datetime.timedelta,
2067+
with_short_max_wait_for_cluster: datetime.timedelta,
20682068
initialized_app: FastAPI,
20692069
scheduler_api: BaseCompScheduler,
20702070
sqlalchemy_async_engine: AsyncEngine,
@@ -2178,7 +2178,7 @@ async def test_pipeline_with_on_demand_cluster_with_no_clusters_keeper_waits_and
21782178
expected_progress=None,
21792179
run_id=run_in_db.run_id,
21802180
)
2181-
await asyncio.sleep(with_short_max_wait_for_clusters_keeper.total_seconds() + 1)
2181+
await asyncio.sleep(with_short_max_wait_for_cluster.total_seconds() + 1)
21822182
# again will trigger the call again, but now it will start failing, first the task will be mark as FAILED
21832183
await scheduler_api.apply(
21842184
user_id=run_in_db.user_id,
@@ -2291,6 +2291,7 @@ async def test_run_new_pipeline_called_twice_prevents_duplicate_runs(
22912291
async def test_getting_task_result_raises_exception_does_not_fail_task_and_retries(
22922292
with_disabled_auto_scheduling: mock.Mock,
22932293
with_disabled_scheduler_publisher: mock.Mock,
2294+
with_short_max_wait_for_retrieving_results: datetime.timedelta,
22942295
mocked_dask_client: mock.MagicMock,
22952296
initialized_app: FastAPI,
22962297
scheduler_api: BaseCompScheduler,

0 commit comments

Comments
 (0)