Skip to content

Commit

Permalink
launcher: support both python2 and python3
Browse files Browse the repository at this point in the history
  • Loading branch information
bobzhuyb authored and ymjiang committed Jun 27, 2019
1 parent 4168812 commit 8589681
Showing 1 changed file with 4 additions and 6 deletions.
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)

0 comments on commit 8589681

Please sign in to comment.