Ray (https://ray.readthedocs.io/en/latest) provides an API to launch code locally or remotely (AWS, GCP).
Plugin interface here.
I will provide an example for a Launcher plugin later.
Awesome - let me know what the Ray team can help with.
Thanks Richard.
I would very much like to have a plugin to launch jobs with Ray, but I don't yet have the cycles to dive into it yet.
If the Ray team can help with the implementation I can definitely help with guidance and examples of similar internal plugins.
Can you provide some examples actually? This will help us with planning/seeing how many resources to allocate to this.
Yes, I was just digging for them. you can see two example plugins that have since been moved elsewhere here:
https://github.com/facebookresearch/hydra/tree/f4338f6416a5adece0ed3f628c348247295bae1c/plugins
submitit and fairtask are two Launcher plugins that are using two different APIs for remote execution.
There is also a central test inside Hydra that can be used to test those plugins in local mode and ensure that they follow the expected protocols which is not in those examples, but would be somewhat similar to how I am testing the Basic Launcher here:
https://github.com/facebookresearch/hydra/blob/master/tests/test_basic_launcher.py#L13-L15
Those examples are a bit outdated but I can give more current ones once someone actually starts working on this.
Here is an updated example Launcher plugin.
It can be used as a template, copy-paste it somewhere and start hacking.
I wrote a very very basic hydra ray launcher plugin that gets the job done for me ! I could do a pull request if it is useful :)
Hi @BadrYoubiIdrissi, this is awesome!
I tried to contact you in email a few weeks ago, you must have missed it.
I would be happy to accept it as an official plugin if you can put some work into polishing and adding some tests.
Please create a PR and we can discuss the missing bits over it.
Sorry it went to spam! ^^ I'll create a PR in the coming days
I know there is #518 which adds this, but it would also be nice to have a plugin that uses _ray_ without _ray_'s autoscaling API. If I understand #518 correctly, it adds an AWS autoscaling mode and a local mode (which is equivalent to not using _ray_ at all). But getting basic _ray_ support could be much simpler.
The simplest use of _ray_ looks something like this:
import ray
ray.init(address="<address of a ray head node>")
@ray.remote(num_cpus=4, num_gpus=1) # specify required resources
def work(x):
time.sleep(10) # replace this with work you need to do.
return x
promises = [work.remote(x) for x in range(10)]
results = ray.get(promises)
print(results)
It should be quite similar to the joblib plugin. (Maybe a bit harder because data might need to be transferred to the _ray_ server...)
I know there is #518 which adds this, but it would also be nice to have a plugin that uses _ray_ without _ray_'s autoscaling API. If I understand #518 correctly, it adds an AWS autoscaling mode and a local mode (which is equivalent to not using _ray_ at all). But getting basic _ray_ support could be much simpler.
The simplest use of _ray_ looks something like this:
import ray ray.init(address="<address of a ray head node>") @ray.remote(num_cpus=4, num_gpus=1) # specify required resources def work(x): time.sleep(10) # replace this with work you need to do. return x promises = [work.remote(x) for x in range(10)] results = ray.get(promises) print(results)It should be quite similar to the joblib plugin. (Maybe a bit harder because data might need to be transferred to the _ray_ server...)
Hi, thanks for your comment!
ray local mode actually calls ray on your local machine, it still calls ray and the implementation is similar to what you suggested above.
ray launcher is released. closing this one.
Most helpful comment
Sorry it went to spam! ^^ I'll create a PR in the coming days