From 38a4c862c19da2c9037b4758512034efbb3b1961 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 7bd3fd270..3dc0bd3a8 100644 --- a/loki/bulk/scheduler.py +++ b/loki/bulk/scheduler.py @@ -641,7 +641,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 498092c15..b7ea9cfc3 100644 --- a/tests/test_scheduler.py +++ b/tests/test_scheduler.py @@ -1424,10 +1424,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] @@ -1490,10 +1487,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]