mirror of
https://github.com/wassname/ray.git
synced 2026-07-23 13:10:11 +08:00
Automatically add relevant directories to Python paths of workers (#380)
* Make ray.init set python paths of workers. * Decouple starting cluster from copying user source code * also add current directory to path * Add comments about deallocation. * Add test for new code path.
This commit is contained in:
committed by
Philipp Moritz
parent
7246013008
commit
e06311d415
@@ -5,19 +5,12 @@ import numpy as np
|
||||
import ray
|
||||
|
||||
parser = argparse.ArgumentParser(description="Parse addresses for the worker to connect to.")
|
||||
parser.add_argument("--user-source-directory", type=str, help="the directory containing the user's application code")
|
||||
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")
|
||||
|
||||
if __name__ == "__main__":
|
||||
args = parser.parse_args()
|
||||
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)
|
||||
ray.worker.connect(args.node_ip_address, args.scheduler_address)
|
||||
|
||||
ray.worker.main_loop()
|
||||
|
||||
Reference in New Issue
Block a user