Skip to content

Commit 27824cd

Browse files
committed
ongoing
1 parent a0791be commit 27824cd

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

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

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2300,16 +2300,24 @@ async def mocked_get_tasks_status(job_ids: list[str]) -> list[RunningState]:
23002300
return [RunningState.SUCCESS for j in job_ids]
23012301

23022302
mocked_dask_client.get_tasks_status.side_effect = mocked_get_tasks_status
2303-
mocked_dask_client.get_task_result.side_effect = exception_type
2303+
call_count = 0
23042304

2305-
# calling apply should not raise, but log the error
2305+
async def mocked_get_task_result(_job_id: str) -> TaskOutputData:
2306+
nonlocal call_count
2307+
call_count += 1
2308+
if call_count > 1:
2309+
raise exception_type
2310+
return TaskOutputData.model_validate({"whatever_output": 123})
2311+
2312+
mocked_dask_client.get_task_result.side_effect = mocked_get_task_result
2313+
# calling apply should not raise
23062314
assert running_project.project.prj_owner
23072315
await scheduler_api.apply(
23082316
user_id=running_project.project.prj_owner,
23092317
project_id=running_project.project.uuid,
23102318
iteration=1,
23112319
)
2312-
2320+
# calling again should not raise neither
23132321
assert running_project.project.prj_owner
23142322
await scheduler_api.apply(
23152323
user_id=running_project.project.prj_owner,

0 commit comments

Comments
 (0)