Skip to content

Commit 0b3b9b2

Browse files
author
Andrei Neagu
committed
do not allow manual intervention for steps that are repeatable
1 parent ed70751 commit 0b3b9b2

File tree

2 files changed

+27
-0
lines changed
  • services/dynamic-scheduler

2 files changed

+27
-0
lines changed

services/dynamic-scheduler/src/simcore_service_dynamic_scheduler/services/generic_scheduler/_operation.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,17 @@ def _validate_operation(operation: Operation) -> dict[StepName, type[BaseStep]]:
277277
raise ValueError(msg)
278278
revert_provided_keys.add(key)
279279

280+
if k == len(operation) - 1 and step_group.repeat_steps is True:
281+
if any(
282+
step.wait_for_manual_intervention()
283+
for step in step_group.get_step_subgroup_to_run()
284+
):
285+
msg = (
286+
"Step groups with repeat_steps=True cannot have steps that require "
287+
"manual intervention. This would lead to a deadlock."
288+
)
289+
raise ValueError(msg)
290+
280291
return detected_steps_names
281292

282293

services/dynamic-scheduler/tests/unit/service_generic_scheduler/test__operation.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,12 @@ class BS2(BaseBS): ...
3939
class BS3(BaseBS): ...
4040

4141

42+
class MI1(BaseBS):
43+
@classmethod
44+
def wait_for_manual_intervention(cls) -> bool:
45+
return True
46+
47+
4248
class WrongBS1C(BaseBS):
4349
@classmethod
4450
def get_create_provides_operation_context_keys(cls) -> set[str]:
@@ -150,6 +156,16 @@ def test_validate_operation_passes(operation: Operation):
150156
[ParallelStepGroup(WrongBS1R, WrongBS2R)],
151157
f"already provided key='revert_key' in {BaseStep.get_revert_provides_operation_context_keys.__name__}",
152158
),
159+
(
160+
[SingleStepGroup(MI1, repeat_steps=True)],
161+
"cannot have steps that require manual intervention",
162+
),
163+
(
164+
[
165+
ParallelStepGroup(MI1, BS1, BS2, repeat_steps=True),
166+
],
167+
"cannot have steps that require manual intervention",
168+
),
153169
],
154170
)
155171
def test_validate_operations_fails(operation: Operation, match: str):

0 commit comments

Comments
 (0)