8000 Need to hard code node names in decision functions · Issue #5 · robdmc/consecution · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Need to hard code node names in decision functions #5
Open
@ghost

Description

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0