Skip to content
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

launcher: support both python2 and python3 #6

Merged
merged 1 commit into from
Jun 27, 2019
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: 4 additions & 6 deletions launcher/launch.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#!/usr/bin/python

from __future__ import print_function
import os
import subprocess
import threading
Expand All @@ -18,7 +19,7 @@ def worker(local_rank, local_size, command):
subprocess.check_call(command, env=my_env, stdout=sys.stdout, stderr=sys.stderr, shell=True)

if __name__ == "__main__":
print "BytePS launching " + os.environ["DMLC_ROLE"]
print("BytePS launching " + os.environ["DMLC_ROLE"])
sys.stdout.flush()

if os.environ["DMLC_ROLE"] == "worker":
Expand All @@ -38,11 +39,8 @@ def worker(local_rank, local_size, command):

else:
if "BYTEPS_SERVER_MXNET_PATH" not in os.environ:
print "BYTEPS_SERVER_MXNET_PATH env not set"
print("BYTEPS_SERVER_MXNET_PATH env not set")
os._exit(0)
sys.path.insert(0, os.getenv("BYTEPS_SERVER_MXNET_PATH")+"/python")
import mxnet
print "BytePS Server MXNet version: " + mxnet.__version__
# TODO: terminates when workers quit
while True:
time.sleep(3600)