https://prefect.io logo
Title
j

James Watt

08/19/2019, 4:03 AM
Hello, how can I get the currently running task's retry attempt? Is it possible to get the elapsed time of the retry delay during the run time as well? Thanks in advance.
c

Chris White

08/19/2019, 4:05 AM
You can get the retry count by accessing `prefect.context.get("task_run_count", 1)`; for “the elapsed time of the retry delay”, you might be able to infer that from one of the datetime objects that are also present in context (more info on that here: https://docs.prefect.io/api/unreleased/utilities/context.html)
j

James Watt

08/19/2019, 5:48 AM
Thank you, Chris. That really helps.👍
c

Chris White

08/19/2019, 5:49 AM
Anytime!