2016-06-27 16:33:12 -07:00
|
|
|
import sys
|
|
|
|
import argparse
|
|
|
|
import numpy as np
|
|
|
|
|
|
|
|
import ray
|
|
|
|
|
|
|
|
parser = argparse.ArgumentParser(description="Parse addresses for the worker to connect to.")
|
2016-07-26 16:18:39 -07:00
|
|
|
parser.add_argument("--user-source-directory", type=str, help="the directory containing the user's application code")
|
2016-08-04 17:47:08 -07:00
|
|
|
parser.add_argument("--node-ip-address", required=True, type=str, help="the ip address of the worker's node")
|
|
|
|
parser.add_argument("--scheduler-address", required=True, type=str, help="the scheduler's address")
|
|
|
|
parser.add_argument("--objstore-address", type=str, help="the objstore's address")
|
2016-06-27 16:33:12 -07:00
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
args = parser.parse_args()
|
2016-07-26 16:18:39 -07:00
|
|
|
if args.user_source_directory is not None:
|
|
|
|
# Adding the directory containing the user's application code to the Python
|
|
|
|
# path so that the worker can import Python modules from this directory. We
|
|
|
|
# insert into the first position (as opposed to the zeroth) because the
|
|
|
|
# zeroth position is reserved for the empty string.
|
|
|
|
sys.path.insert(1, args.user_source_directory)
|
2016-08-04 17:47:08 -07:00
|
|
|
ray.worker.connect(args.node_ip_address, args.scheduler_address)
|
2016-06-27 16:33:12 -07:00
|
|
|
|
2016-07-08 12:46:47 -07:00
|
|
|
ray.worker.main_loop()
|