1

Following is my flow:-

class APLWorkflow(Flow):

    start = (
        flow.StartFunction(function1)
        .Next(this.request_quotes)
    )

    request_quotes = (
        flow.Handler(function2)
        .Next(this.move_package)
    )

    move_package = (
        flow.Handler(function3)
        .Next(this.shipment_create)
    )

    shipment_create = (
        flow.Function(function4)
        .Next(this.end)
    )

    end = flow.End()

Following are my util functions:-

def function1():
    return 1


def function2():
    return 2


def function3():
    return 3


def function4():
    return 4

The problem is when I start the flow, it runs perfectly well. However, the response returned is that of start node, not the last executed node.

Following is my code:-

activation.prepare()
response = APLWorkFLow.start.run(**some_kwargs)
activation.done() # stops the flow at `move_package`.    
print(response)  # prints 1, not 3.

How do I return the response of the last executed node, in this Handler (move_package)?

Praful Bagai
  • 16,684
  • 50
  • 136
  • 267
  • This also looks live viewflow misuse. If you need a function call - use plain python functions. – kmmbvnr Aug 17 '18 at 08:37
  • @kmmbvnr - This was just an example. However the exact flow is different. The question still stands, ie how can I get the Handler response? – Praful Bagai Aug 17 '18 at 09:38
  • There is no way to get this. Obviously, it's a bad practice to make a caller dependent on flow details. Your code would be broken on a first flow change. If you need a call of several python functions in a row, just create a python function – kmmbvnr Aug 21 '18 at 06:12

0 Answers0