如何在工人身上推出带有诗意的ray tune

How to launch ray tune with poetry on workers

让 ray worker 在特定目录和特定虚拟环境中 运行 的秘诀是什么?我觉得我缺少一些基本的东西:

我想 运行 ray tune 进行超参数调整(使用 aws)。当我启动 head(和 worker)时,我想 运行 从虚拟机中发出光线(在我的例子中是诗歌)。它根本不起作用。我试过了:

setup_commands: 
    - cd /home/ubuntu/myimportantdirectory 
    - poetry shell

但后来我得到

2020-02-25 17:34:28,592 INFO updater.py:256 -- NodeUpdater: i-0893fd1914fd8743e: Running cd /home/ubuntu/myimportantdirectory on 18.207.133.151...
bash: cannot set terminal process group (-1): Inappropriate ioctl for device

...我猜这意味着它失败了,因为诗歌因 could not find a pyproject.toml file in /home/ubuntu or its parents

而失败

我也试过了

setup_commands: 
    - cd /home/ubuntu/myimportantdirectory 
    - . path/to/poetry/activate

但后来我得到 Command 'ray' not found,尽管我确定它在那里。

这行得通。但一定有更好的方法。我也不敢相信这没有记录在案。在 yaml 中,执行此操作:

head_start_ray_commands:
    - . /home/ubuntu/.cache/pypoetry/virtualenvs/robotics-7LCEAdjK-py3.6/bin/activate; ray stop
    - ulimit -n 65536; . /home/ubuntu/.cache/pypoetry/virtualenvs/robotics-7LCEAdjK-py3.6/bin/activate; ray start --head --redis-port=6379 --object-manager-port=8076 --autoscaling-config=~/ray_bootstrap_config.yaml

worker_start_ray_commands:
    - . /home/ubuntu/.cache/pypoetry/virtualenvs/robotics-7LCEAdjK-py3.6/bin/activate; ray stop
    - ulimit -n 65536; . /home/ubuntu/.cache/pypoetry/virtualenvs/robotics-7LCEAdjK-py3.6/bin/activate; ray start --redis-address=$RAY_HEAD_IP:6379 --object-manager-port=8076