From 8c578a4929cc714ede2a135e7f3039feee5fd4a9 Mon Sep 17 00:00:00 2001 From: Michael Lange Date: Mon, 18 Sep 2023 12:29:17 +0000 Subject: [PATCH] Scheduler: Provide full meta-data for file-graph traversals Since we potentially have a one-to-many mapping here, we simply use the first `item` to provide the meta-data. This is a bit hacky, but needs full SGraph development to be fixed "properly". --- loki/bulk/scheduler.py | 6 +++++- tests/test_scheduler.py | 10 ++-------- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/loki/bulk/scheduler.py b/loki/bulk/scheduler.py index 97f6a6b38..1cc726caa 100644 --- a/loki/bulk/scheduler.py +++ b/loki/bulk/scheduler.py @@ -656,7 +656,11 @@ def process(self, transformation): if not items: continue - transformation.apply(items[0].source, items=items) + _item = items[0] + transformation.apply( + items[0].source, role=_item.role, mode=_item.mode, + item=_item, items=items, targets=_item.targets, + ) else: for item in traversal: if item_filter and not isinstance(item, item_filter): diff --git a/tests/test_scheduler.py b/tests/test_scheduler.py index f2a696f33..6d2cb4e74 100644 --- a/tests/test_scheduler.py +++ b/tests/test_scheduler.py @@ -1497,10 +1497,7 @@ def __init__(self): self.record = [] def transform_file(self, sourcefile, **kwargs): - if 'item' in kwargs: - self.record += [kwargs['item'].name + '::' + sourcefile.path.name] - else: - self.record += [sourcefile.path.name] + self.record += [sourcefile.path.name] def transform_module(self, module, **kwargs): self.record += [kwargs['item'].name + '::' + module.name] @@ -1563,10 +1560,7 @@ def __init__(self): self.record = [] def transform_file(self, sourcefile, **kwargs): - if 'item' in kwargs: - self.record += [kwargs['item'].name + '::' + sourcefile.path.name] - else: - self.record += [sourcefile.path.name] + self.record += [sourcefile.path.name] def transform_module(self, module, **kwargs): self.record += [kwargs['item'].name + '::' + module.name]