Skip to content

Back out "monarch_env: use main_function for -allocator target" #25

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
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: 8 additions & 2 deletions python/monarch/bootstrap_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,16 @@
import sys


def invoke_main():
async def main():
await bootstrap_main()


def invoke_main() -> None:
# if this is invoked with the stdout piped somewhere, then print
# changes its buffering behavior. So we default to the standard
# behavior of std out as if it were a terminal.
sys.stdout.reconfigure(line_buffering=True)
global bootstrap_main
# TODO: figure out what from worker_main.py we should reproduce here.
from monarch._rust_bindings.monarch_hyperactor.bootstrap import bootstrap_main

Expand All @@ -30,8 +35,9 @@ def invoke_main():
# fallback to using local py-spy

# Start an event loop for PythonActors to use.
asyncio.run(bootstrap_main())
asyncio.run(main())


if __name__ == "__main__":
# Do not add code here, it won't be run. Add them to the function called below.
invoke_main() # pragma: no cover