start the player server in a more robost way.
This commit is contained in:
parent
6cb4b02fca
commit
b8bdfea8bd
@ -4,6 +4,7 @@ import re
|
||||
import Pyro4
|
||||
import time
|
||||
|
||||
if __name__ == '__main__':
|
||||
# start a name server to find the remote object
|
||||
kill_old_server = subprocess.Popen(['killall', 'pyro4-ns'])
|
||||
print "kill old server, the return code is : " + str(kill_old_server.wait())
|
||||
@ -13,11 +14,16 @@ print "Start Name Sever : " + str(start_new_server.pid)# + str(start_new_server.
|
||||
time.sleep(1)
|
||||
agent_v0 = subprocess.Popen(['python', '-u', 'player.py', '--role=black'],
|
||||
stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
|
||||
print "Start Player 0 at : " + str(agent_v0.pid)
|
||||
agent_v1 = subprocess.Popen(['python', '-u', 'player.py', '--role=white', '--checkpoint_path=./checkpoints_origin/'],
|
||||
stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
|
||||
print "Start Player 1 at : " + str(agent_v1.pid)
|
||||
time.sleep(5)
|
||||
server_list = ""
|
||||
while ("black" not in server_list) or ("white" not in server_list):
|
||||
server_list = subprocess.check_output(['pyro4-nsc', 'list'])
|
||||
print "Waining for the server start..."
|
||||
time.sleep(1)
|
||||
print server_list
|
||||
print "Start black player at : " + str(agent_v0.pid)
|
||||
print "Start white player at : " + str(agent_v1.pid)
|
||||
|
||||
player = [None] * 2
|
||||
player[0] = Pyro4.Proxy("PYRONAME:black")
|
||||
|
Loading…
x
Reference in New Issue
Block a user