flapili
06/04/2024, 12:43 PMNate
06/04/2024, 7:38 PMretry_delay_seconds
should be what you want here
In [1]: from prefect import flow, task
In [2]: import time
...:
...: @flow
...: def f():
...: @task(retries=1, retry_delay_seconds=10)
...: def foo():
...: raise ValueError
...: t = time.monotonic()
...: state = foo(return_state=True)
...: assert state.is_failed()
...: assert (delta := time.monotonic() - t) > 10, f"got {delta}"
...: return "successfully failed"
...:
In [3]: f()
....
14:38:18.505 | ERROR | Task run 'foo-0' - Finished in state Failed('Task run encountered an exception ValueError: ')
14:38:18.683 | INFO | Flow run 'gigantic-myna' - Finished in state Completed()
Out[4]: 'successfully failed'
In [5]: !prefect version
Version: 2.19.3+6.g9c584e88a6
flapili
06/04/2024, 7:40 PMNate
06/04/2024, 7:41 PMNate
06/04/2024, 7:42 PMNate
06/04/2024, 7:42 PMflapili
06/04/2024, 7:43 PMflapili
06/04/2024, 7:43 PMNate
06/04/2024, 7:44 PMflapili
06/04/2024, 7:44 PMflapili
06/04/2024, 7:45 PMlatest 2.x should already have it thoughI believe I already add this issue like few years ago
flapili
06/04/2024, 7:45 PMNate
06/04/2024, 7:46 PMretry_delay_seconds
should be supported in 2.x (like in my example above) but we accidentally dropped it when rewriting the engine (the RC version) and so we'll add it back!flapili
06/04/2024, 7:46 PMflapili
06/04/2024, 8:02 PMNate
06/04/2024, 8:02 PMflapili
06/04/2024, 8:02 PMflapili
06/04/2024, 8:03 PM22:01:47.321 | ERROR | asyncio - Exception in callback SubprocessStreamProtocol.pipe_data_received(2, b'Traceback (...arted\r\n\r\n')
handle: <Handle SubprocessStreamProtocol.pipe_data_received(2, b'Traceback (...arted\r\n\r\n')>
Traceback (most recent call last):
File "C:\Users\admin\.rye\py\cpython@3.12.2\install\Lib\asyncio\events.py", line 88, in _run
self._context.run(self._callback, *self._args)
File "C:\Users\admin\.rye\py\cpython@3.12.2\install\Lib\asyncio\subprocess.py", line 72, in pipe_data_received
reader.feed_data(data)
File "C:\Users\admin\.rye\py\cpython@3.12.2\install\Lib\asyncio\streams.py", line 500, in feed_data
assert not self._eof, 'feed_data after feed_eof'
AssertionError: feed_data after feed_eof
22:01:47.325 | ERROR | asyncio - Exception in callback SubprocessStreamProtocol.pipe_data_received(2, b'Application... Exiting.\r\n')
handle: <Handle SubprocessStreamProtocol.pipe_data_received(2, b'Application... Exiting.\r\n')>
Traceback (most recent call last):
File "C:\Users\admin\.rye\py\cpython@3.12.2\install\Lib\asyncio\events.py", line 88, in _run
self._context.run(self._callback, *self._args)
File "C:\Users\admin\.rye\py\cpython@3.12.2\install\Lib\asyncio\subprocess.py", line 72, in pipe_data_received
reader.feed_data(data)
File "C:\Users\admin\.rye\py\cpython@3.12.2\install\Lib\asyncio\streams.py", line 500, in feed_data
assert not self._eof, 'feed_data after feed_eof'
AssertionError: feed_data after feed_eof
flapili
06/04/2024, 8:03 PMflapili
06/04/2024, 8:09 PMflapili
06/04/2024, 8:11 PMflapili
06/04/2024, 8:12 PM