Skip to content
Snippets Groups Projects
Commit 16378cca authored by Gerhard Raven's avatar Gerhard Raven
Browse files

pythonize walking dependendencies

parent 201afa43
No related branches found
No related tags found
1 merge request!3805unify packing code further, pack multiple types with a single packer
......@@ -103,18 +103,19 @@ def configured_ann_svc(name='HltANNSvc',
return setup_component('GitANNSvc', instance_name=name, **kwargs)
def _walk_datadependencies(f, top, *args):
def __walk(visited, f, top, *args):
def _datadependencies(top):
def __walk(visited, top):
if top.name in visited: return
f(top, *args)
yield top
visited.add(top.name)
for handles in top.inputs.values():
handles = handles if isinstance(handles, list) else [handles]
for handle in handles:
__walk(visited, f, handle.producer, *args)
for p in __walk(visited, handle.producer):
yield p
visited = set()
__walk(visited, f, top, *args)
return __walk(visited, top)
def _get_algs(top_cf, pred=lambda i: True):
......@@ -800,8 +801,7 @@ def configure(options, control_flow_node, public_tools=[],
configuration = dataflow_config()
barriers = set()
for alg in algs:
_walk_datadependencies(
lambda i: barriers.add(i.name) if i.is_barrier else None, alg)
barriers.update(i.name for i in _datadependencies(alg) if i.is_barrier)
configuration.update(alg.configuration())
for tool in public_tools:
configuration.update(tool.configuration())
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment