YD
12/21/2022, 9:50 PMallow_failure
does not work as expected
I am trying to see how can I continue with a workflow after a task failed all the allowed retries.
Sample code:
from prefect import task, flow, get_run_logger, allow_failure
from time import sleep
@task(retries=2, timeout_seconds=3)
def test_1(o, test_retries):
if test_retries:
sleep(5)
else:
raise IOError('Raising some error')
return True
@flow(name='test allow_failure')
def run_test_flow():
result = test_1.submit(True, True)
result = test_1.submit(result, False, wait_for=allow_failure(result))
if __name__ == "__main__":
run_test_flow()
I expect this to run test_1.submit
, fail twice, since the sleep
is larger than the timeout_seconds
, and then run the second test_1.submit
But it does not appear to be working
it does not run the second test_1.submit
@User, @User do you have thoughts on this ?Jeff Hale
12/23/2022, 2:28 PMtimeout_seconds=10
then it raised the IOError:
File "/Users/jeffhale/Desktop/prefect/allow_failure_slack_example.py", line 10, in test_1
raise IOError("Raising some error")
OSError: Raising some error
Does the longer timeout fix it for you?YD
01/02/2023, 4:59 PMwait_for
, I do not get the raise IOError('Raising some error')
errorresult = test_1.submit(True, True)
and then you get the Raising some error
but the point of this test is to see if the second task runs when the first task fails with to many retriesJeff Hale
01/02/2023, 6:54 PMYD
01/02/2023, 9:02 PM