Skip to content

Commit

Permalink
Scheduler: Provide full meta-data for file-graph traversals
Browse files Browse the repository at this point in the history
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".
  • Loading branch information
mlange05 committed Nov 30, 2023
1 parent 0e4c8c5 commit 8c578a4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
6 changes: 5 additions & 1 deletion loki/bulk/scheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
10 changes: 2 additions & 8 deletions tests/test_scheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down Expand Up @@ -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]
Expand Down

0 comments on commit 8c578a4

Please sign in to comment.