https://prefect.io logo
Title
j

Jacques

04/21/2020, 4:21 PM
Hi all, is it possible to get the state of a running flow from the Flow object or FlowRunner?
z

Zachary Hughes

04/21/2020, 4:26 PM
Hi @Jacques! I'm asking the team now-- hope to have an answer for you in just a sec! šŸ™‚
j

Jacques

04/21/2020, 4:36 PM
Awesome, thanks!
z

Zachary Hughes

04/21/2020, 4:38 PM
Back with an answer! We don't persist the state object anywhere unless you're using one of our orchestration solutions (Prefect Server or Prefect Cloud). So my recommendation would be to either: • use Prefect Server or • if you really just care about the result of the first task, and not the state of it, a result handler could do the trick.
If neither of those works for you, you could also use a state handler to persist the information you need in some sort of stored memory location. But that feels a bit less clean to me.
j

Jacques

04/21/2020, 4:45 PM
Cheers, will pursue the result handler route - thanks for the crazy quick feedback!
z

Zachary Hughes

04/21/2020, 4:45 PM
Sure thing! Don't hesitate to reach out if you have any additional questions!
j

Jacques

04/21/2020, 5:22 PM
Just in case you are interested, I think I found a slightly cleaner (to me at least) way to do this. I'm saving the page token (my flow is paging through an API with dynamic page tokens and saving the results to bigquery) I get as part of the extract task (actual data from API goes through normal flow chain) in a class variable (so self.page_token= in my Task ) then looking at the flow.tasks outside the thread for page_tokens, then starting new flows to deal with additional pages.
seems to work well, no idea if this is a terrible thing to do šŸ™‚
z

Zachary Hughes

04/21/2020, 10:59 PM
Awesome, I'm glad that's working well for you!