Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion flytekit/extend/backend/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"]:
Expand Down
2 changes: 1 addition & 1 deletion tests/flytekit/unit/extend/test_connector.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 2 additions & 4 deletions tests/flytekit/unit/utils/test_rate_limiter.py
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Copy link
Member Author

@machichima machichima Sep 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Create a fresh event loop each time and prevent using existing event loop. This fixes the CI test fail: https://github.com/flyteorg/flytekit/actions/runs/17783377366/job/50554009811



@pytest.mark.asyncio
Expand All @@ -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
Expand Down