diff --git a/flytekit/extend/backend/utils.py b/flytekit/extend/backend/utils.py index dfeb106a42..9bcc654927 100644 --- a/flytekit/extend/backend/utils.py +++ b/flytekit/extend/backend/utils.py @@ -20,8 +20,10 @@ def convert_to_flyte_phase(state: str) -> TaskExecution.Phase: Convert the state from the connector to the phase in flyte. """ state = state.lower() - if state in ["failed", "timeout", "timedout", "canceled", "cancelled", "skipped", "internal_error"]: + if state in ["failed", "timeout", "timedout", "canceled", "cancelled", "skipped"]: return TaskExecution.FAILED + if state in ["internal_error"]: + return TaskExecution.RETRYABLE_FAILED elif state in ["done", "succeeded", "success", "completed"]: return TaskExecution.SUCCEEDED elif state in ["running", "terminating"]: diff --git a/tests/flytekit/unit/extend/test_connector.py b/tests/flytekit/unit/extend/test_connector.py index 0f29083512..217210171b 100644 --- a/tests/flytekit/unit/extend/test_connector.py +++ b/tests/flytekit/unit/extend/test_connector.py @@ -383,7 +383,7 @@ def test_convert_to_flyte_phase(): assert convert_to_flyte_phase("TIMEDOUT") == TaskExecution.FAILED assert convert_to_flyte_phase("CANCELED") == TaskExecution.FAILED assert convert_to_flyte_phase("SKIPPED") == TaskExecution.FAILED - assert convert_to_flyte_phase("INTERNAL_ERROR") == TaskExecution.FAILED + assert convert_to_flyte_phase("INTERNAL_ERROR") == TaskExecution.RETRYABLE_FAILED assert convert_to_flyte_phase("DONE") == TaskExecution.SUCCEEDED assert convert_to_flyte_phase("SUCCEEDED") == TaskExecution.SUCCEEDED diff --git a/tests/flytekit/unit/utils/test_rate_limiter.py b/tests/flytekit/unit/utils/test_rate_limiter.py index 23bece6415..862f0d79fb 100644 --- a/tests/flytekit/unit/utils/test_rate_limiter.py +++ b/tests/flytekit/unit/utils/test_rate_limiter.py @@ -19,8 +19,7 @@ async def helper_for_async(rpm: int, total: int): def runner_for_async(rpm: int, total: int): - loop = asyncio.get_event_loop() - return loop.run_until_complete(helper_for_async(rpm, total)) + return asyncio.run(helper_for_async(rpm, total)) @pytest.mark.asyncio @@ -43,8 +42,7 @@ async def helper_for_sync(rpm: int, total: int): def runner_for_sync(rpm: int, total: int): - loop = asyncio.get_event_loop() - return loop.run_until_complete(helper_for_sync(rpm, total)) + return asyncio.run(helper_for_sync(rpm, total)) @pytest.mark.asyncio