Skip to content

Commit 5b93f6f

Browse files
committed
Merge branch 'optional_runnability_checks' into develop
2 parents dd3c8f2 + d1ee3a6 commit 5b93f6f

2 files changed

Lines changed: 16 additions & 3 deletions

File tree

ymmsl/v0_2/configuration.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ def update(self, overlay: 'Configuration') -> None:
181181
self.checkpoints.update(overlay.checkpoints)
182182
self.resume.update(overlay.resume)
183183

184-
def check_consistent(self) -> None:
184+
def check_consistent(self, check_runnable: bool = True) -> None:
185185
"""Checks that the configuration is internally consistent.
186186
187187
This checks:
@@ -197,6 +197,10 @@ def check_consistent(self) -> None:
197197
198198
If any of these requirements is false, this function will raise a RuntimeError
199199
with an explanation of the problem.
200+
201+
Args:
202+
check_runnable: if False, skip the checks for whether component
203+
implementations exist and whether resources have been requested.
200204
"""
201205
errors = list()
202206

@@ -207,11 +211,13 @@ def check_consistent(self) -> None:
207211
errors.extend(self._check_duplicate_implementations())
208212

209213
component_paths = self._component_paths()
210-
errors.extend(self._check_implementations_exist(component_paths))
214+
if check_runnable:
215+
errors.extend(self._check_implementations_exist(component_paths))
211216
errors.extend(self._check_consistent_ports(component_paths))
212217
errors.extend(self._check_custom_implementations(component_paths))
213218
errors.extend(self._check_consistent_settings(component_paths))
214-
errors.extend(self._check_resources(component_paths))
219+
if check_runnable:
220+
errors.extend(self._check_resources(component_paths))
215221

216222
if errors:
217223
raise RuntimeError(

ymmsl/v0_2/tests/test_configuration.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -372,6 +372,11 @@ def test_check_inconsistent_implementation_ports(
372372

373373
assert len(str(e.value).split('\n')) == 8
374374

375+
with pytest.raises(RuntimeError) as e:
376+
config_inconsistent_impl_ports.check_consistent(False)
377+
378+
assert len(str(e.value).split('\n')) == 7
379+
375380

376381
def test_check_consistent_custom_implementations(
377382
config_consistent_custom_impls: Configuration) -> None:
@@ -425,3 +430,5 @@ def test_check_inconsistent_resources(
425430
config_inconsistent_resources.check_consistent()
426431

427432
assert len(str(e.value).split('\n')) == 4
433+
434+
config_inconsistent_resources.check_consistent(False)

0 commit comments

Comments
 (0)