Hello! If prefect pipeline fails partially (when u...
# prefect-community
k
Hello! If prefect pipeline fails partially (when using Pipeline.run()) is it possible to retrieve _State_s and results for the tasks that executed successfully?
j
Yes. If a task (or tasks) fail in
flow.run()
, the
flow.run()
call will still return the flow state with a
.result
map of all task states (successful or failed).
c
Hi @Krzysztof Nawara! Yes, when running interactively you can retrieve all task states as follows:
Copy code
flow_state = flow.run()

flow_state.result # a dictionary of Task -> State

success_states = {t: state for t, state in flow_state.result.items() if state.is_successful()}
k
Thanks, I'm gonna try it out!