Skip to content

Commit

Permalink
Merge pull request #403 from ecmwf-ifs/nabr-fix-373
Browse files Browse the repository at this point in the history
Fix Scheduler instantiation without config (fix #373)
  • Loading branch information
reuterbal authored Oct 16, 2024
2 parents d6ba9c9 + 26c17a4 commit e7a3c4f
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
2 changes: 1 addition & 1 deletion loki/batch/scheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ def __init__(self, paths, config=None, seed_routines=None, preprocess=False,
elif isinstance(config, (str, Path)):
self.config = SchedulerConfig.from_file(config)
else:
self.config = SchedulerConfig.from_dict(config)
self.config = SchedulerConfig.from_dict(config or {})

self.full_parse = full_parse

Expand Down
14 changes: 14 additions & 0 deletions loki/batch/tests/test_scheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,20 @@ def test_scheduler_enrichment(testdir, config, frontend, tmp_path):
assert call.routine is call_item.ir


def test_scheduler_empty_config(testdir, frontend, tmp_path):
"""
Test that instantiating the Scheduler without config works (albeit it's not very useful)
This fixes #373
"""
projA = testdir/'sources/projA'

scheduler = Scheduler(
paths=projA, includes=projA/'include',
seed_routines=['driverA'], frontend=frontend, xmods=[tmp_path]
)
assert scheduler.items == ('drivera_mod#drivera',)


@pytest.mark.skipif(not graphviz_present(), reason='Graphviz is not installed')
@pytest.mark.parametrize('with_file_graph', [True, False, 'filegraph_simple'])
@pytest.mark.parametrize('with_legend', [True, False])
Expand Down

0 comments on commit e7a3c4f

Please sign in to comment.