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 16, 2023
1 parent 4ef0e1d commit 66f57ee
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 @@ -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):
Expand Down
10 changes: 2 additions & 8 deletions tests/test_scheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down Expand Up @@ -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]
Expand Down

0 comments on commit 66f57ee

Please sign in to comment.