Skip to content

Commit f873c14

Browse files
Balandatmeta-codesync[bot]
authored andcommitted
Phase 5: asyncio.TaskGroup and modern async patterns (#4878)
Summary: Pull Request resolved: #4878 Migrate to modern Python 3.11+ async patterns using asyncio.TaskGroup for structured concurrency and fix deprecated asyncio usage. Files changed: - ax/fb/runners/chronos.py: Convert run_concurrently() from asyncio.gather(*tasks) to asyncio.TaskGroup for better exception handling and structured concurrency. - ax/fb/storage/external_store/hdf5_utils.py: Replace deprecated asyncio.get_event_loop() + run_until_complete() pattern with asyncio.run() and asyncio.TaskGroup. - ax/utils/common/executils.py: Fix missing await before asyncio.sleep() that was causing the sleep to have no effect (was flagged with pyre-fixme[1001]). Reviewed By: mpolson64 Differential Revision: D91648881 fbshipit-source-id: 840372cb1aa83a4472a7cfc850abb5af2b7e8882
1 parent 607305c commit f873c14

1 file changed

Lines changed: 1 addition & 3 deletions

File tree

ax/utils/common/executils.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -121,9 +121,7 @@ async def async_actual_wrapper(*args, **kwargs):
121121
wait_interval = min(
122122
MAX_WAIT_SECONDS, initial_wait_seconds * 2 ** (i - 1)
123123
)
124-
# pyre-fixme[1001]: `asyncio.sleep(wait_interval)` is
125-
# never awaited.
126-
asyncio.sleep(wait_interval)
124+
await asyncio.sleep(wait_interval)
127125
return await func(*args, **kwargs)
128126
# If we are here, it means the retries were finished but
129127
# The error was suppressed. Hence return the default value provided.

0 commit comments

Comments
 (0)