Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Dan King committed Oct 25, 2023
1 parent b0e5ce5 commit e977803
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions hail/python/hailtop/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ def main_thread_event_loop():

import asyncio # pylint: disable=import-outside-toplevel
import threading # pylint: disable=import-outside-toplevel
import nest_asyncio # pylint: disable=import-outside-toplevel

if _hail_created_the_main_thread_event_loop:
raise ValueError(
Expand All @@ -53,7 +54,6 @@ def main_thread_event_loop():

try:
asyncio.get_running_loop()
import nest_asyncio
nest_asyncio.apply()
return asyncio.get_running_loop()
except RuntimeError as err:
Expand All @@ -64,7 +64,7 @@ def main_thread_event_loop():
'yourself with asyncio.set_event_loop before initializing Hail if you want to run '
'Hail outside the Main Thread. Note that Hail is not thread-safe. Current thread: '
f'{threading.current_thread()}'
)
) from err
loop = asyncio.new_event_loop()
asyncio.set_event_loop(loop)
_hail_created_the_main_thread_event_loop = True
Expand Down

0 comments on commit e977803

Please sign in to comment.