Hi all, is it possible to get the state of a runni...
# prefect-community
j
Hi all, is it possible to get the state of a running flow from the Flow object or FlowRunner?
z
Hi @Jacques! I'm asking the team now-- hope to have an answer for you in just a sec! šŸ™‚
j
Awesome, thanks!
z
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
Cheers, will pursue the result handler route - thanks for the crazy quick feedback!
z
Sure thing! Don't hesitate to reach out if you have any additional questions!
j
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
Awesome, I'm glad that's working well for you!