Skip to content
Merged
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
10 changes: 6 additions & 4 deletions python/ray/_private/async_compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,25 @@
import inspect
from functools import lru_cache

from ray._private.ray_constants import env_bool

try:
import uvloop
except ImportError:
uvloop = None


def get_new_event_loop():
"""Construct a new event loop. Ray will use uvloop if it exists"""
if uvloop:
"""Construct a new event loop. Ray will use uvloop if it exists and is enabled"""
if uvloop and env_bool("RAY_USE_UVLOOP", True):
return uvloop.new_event_loop()
else:
return asyncio.new_event_loop()


def try_install_uvloop():
"""Installs uvloop as event-loop implementation for asyncio (if available)"""
if uvloop:
"""Installs uvloop as event-loop implementation for asyncio (if available and enabled)"""
if uvloop and env_bool("RAY_USE_UVLOOP", True):
uvloop.install()
else:
pass
Expand Down