diff --git a/services/director-v2/src/simcore_service_director_v2/utils/computations.py b/services/director-v2/src/simcore_service_director_v2/utils/computations.py index 93e3197c71b..bd04303dc02 100644 --- a/services/director-v2/src/simcore_service_director_v2/utils/computations.py +++ b/services/director-v2/src/simcore_service_director_v2/utils/computations.py @@ -26,6 +26,12 @@ RunningState.NOT_STARTED, RunningState.WAITING_FOR_CLUSTER, ): RunningState.WAITING_FOR_CLUSTER, + # if there are tasks waiting for resources and nothing is running/pending, then the pipeline is also waiting for resources + ( + RunningState.PUBLISHED, + RunningState.NOT_STARTED, + RunningState.WAITING_FOR_RESOURCES, + ): RunningState.WAITING_FOR_RESOURCES, # if there are PENDING states that means the pipeline was published and is awaiting sidecars ( RunningState.PENDING, diff --git a/services/director-v2/tests/unit/test_utils_computation.py b/services/director-v2/tests/unit/test_utils_computation.py index 046326a296c..ef276d5bc69 100644 --- a/services/director-v2/tests/unit/test_utils_computation.py +++ b/services/director-v2/tests/unit/test_utils_computation.py @@ -257,6 +257,15 @@ def fake_task(fake_task_file: Path) -> CompTaskAtDB: RunningState.WAITING_FOR_CLUSTER, id="published and waiting for cluster = waiting for cluster", ), + pytest.param( + [ + (RunningState.WAITING_FOR_RESOURCES), + (RunningState.PUBLISHED), + (RunningState.PUBLISHED), + ], + RunningState.WAITING_FOR_RESOURCES, + id="published and waiting for resources = waiting for resources", + ), ], ) def test_get_pipeline_state_from_task_states(