updating addresses and adding tests

This commit is contained in:
Robert Nishihara
2016-03-10 14:40:46 -08:00
parent b63d20126d
commit d2aa71de76
5 changed files with 94 additions and 55 deletions
+7 -8
View File
@@ -8,10 +8,9 @@ import orchestra_pb2
import types_pb2
parser = argparse.ArgumentParser(description='Parse addresses for the worker to connect to.')
parser.add_argument("--ip_address", default="127.0.0.1", help="the IP address to use for both the scheduler and objstore")
parser.add_argument("--scheduler_port", default=10001, type=int, help="the scheduler's port")
parser.add_argument("--objstore_port", default=20001, type=int, help="the objstore's port")
parser.add_argument("--worker_port", default=40001, type=int, help="the worker's port")
parser.add_argument("--scheduler-address", default="127.0.0.1:10001", type=str, help="the scheduler's address")
parser.add_argument("--objstore-address", default="127.0.0.1:20001", type=str, help="the objstore's address")
parser.add_argument("--worker-address", default="127.0.0.1:40001", type=str, help="the worker's address")
@worker.distributed([str], [str])
def print_string(string):
@@ -24,8 +23,8 @@ def print_string(string):
def handle_int(a, b):
return a + 1, b + 1
def connect_to_scheduler(host, port):
channel = implementations.insecure_channel(host, port)
def connect_to_scheduler(address):
channel = implementations.insecure_channel(address)
return orchestra_pb2.beta_create_Scheduler_stub(channel)
def address(host, port):
@@ -33,7 +32,7 @@ def address(host, port):
if __name__ == '__main__':
args = parser.parse_args()
scheduler_stub = connect_to_scheduler(args.ip_address, args.scheduler_port)
worker.connect(address(args.ip_address, args.scheduler_port), address(args.ip_address, args.objstore_port), address(args.ip_address, args.worker_port))
scheduler_stub = connect_to_scheduler(args.scheduler_address)
worker.connect(args.scheduler_address, args.objstore_address, args.worker_address))
import IPython
IPython.embed()