Is there a way for me to define a Flow in such a way as to be generic and then I can subclass it for each child flow? I am looking to reduce code repetition for some flows I have that follow a general pattern, but have small differences, or added steps/tasks. I don't think the imperative API is what I am looking for.
k
Kevin Kho
06/22/2021, 6:28 PM
I have seen some users do this. Here is an example:
I guess you would just add the stuff in the init method?
t
Tim Enders
06/22/2021, 6:31 PM
ok, so if I take the parameters I pass to the
with Flow()
and pass them to
super().__init()
I can then add Tasks via the imperative API inside my init?
Tim Enders
06/22/2021, 6:35 PM
would the imperative style work inside a function like that?
k
Kevin Kho
06/22/2021, 6:41 PM
I don’t think you can set Tasks like that with this init, unless you just call Task.run() which calls the Python function underneath the task. At that point, you lose the monitoring since it isn’t a Task. I think it might be easier if you create a function that generates a flow and return it, and then go imperative style all the way?
t
Tim Enders
06/22/2021, 6:44 PM
hmmm... that may not be as helpful as I would want, but it sounds promsing. Thank you
Bring your towel and join one of the fastest growing data communities. Welcome to our second-generation open source orchestration platform, a completely rethought approach to dataflow automation.