consecution
consecution copied to clipboard
Need to hard code node names in decision functions
At the moment you need to hard code the node names from the pipeline in functions used for routing. For example (from the documentation):
def route_func(item):
if item % 2 == 0:
return 'even_node'
else:
return 'odd_node'
I created a helper function to get around this issue, but feel there must be a better way...
def route_decision(decision_function, yes_node, no_node, **kwargs):
router_function = lambda item: decision_function(item, yes_node.name, no_node.name, **kwargs)
return [yes_node, no_node, router_function]
This enables the function above to be re-written like:
def route_func(item, yes_node_name, no_node_name):
if item % 2 == 0:
return yes_node_name
else:
return no_node_name
It would be ideal if the framework didn't require any hard coding of the node names.