# Multiple jobs with different dependencies

**URL:** <https://discuss.ray.io/t/multiple-jobs-with-different-dependencies/548>\
**Category:** Ray Core\
**Created:** [January 22, 2021, 8:34pm UTC](https://discuss.ray.io/t/multiple-jobs-with-different-dependencies/548 "2021-01-22T20:34:07Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![raghukiran](https://avatars.discourse-cdn.com/v4/letter/r/e68b1a/32.png) [@raghukiran](https://discuss.ray.io/u/raghukiran)\
**Post date:** [January 22, 2021, 8:34pm UTC](https://discuss.ray.io/t/multiple-jobs-with-different-dependencies/548/1 "2021-01-22T20:34:07Z")

</div>

Hi,

If I have multiple jobs, with each job having a conflicting dependency. How do I run them in a single Ray cluster?

Regards,  
Raghu

---

<div class="post-metadata">

**Author:** ![sangcho](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/sangcho/32/425_2.png) [@sangcho](https://discuss.ray.io/u/sangcho)\
**Post date:** [January 22, 2021, 8:36pm UTC](https://discuss.ray.io/t/multiple-jobs-with-different-dependencies/548/2 "2021-01-22T20:36:41Z")

</div>

We don’t support any hard dependency isolation, but there’s a way to set the environment variables for all workers used in the same job (in this way, you can specify the conda env for each job. It is not publicly available though). Is this type of support sufficient for your use case?

---

<div class="post-metadata">

**Author:** ![raghukiran](https://avatars.discourse-cdn.com/v4/letter/r/e68b1a/32.png) [@raghukiran](https://discuss.ray.io/u/raghukiran)\
**Post date:** [January 22, 2021, 8:49pm UTC](https://discuss.ray.io/t/multiple-jobs-with-different-dependencies/548/3 "2021-01-22T20:49:09Z")

</div>

Thanks @sangcho - that would be a good starting point for us. Can you please provide a pointer and how to use?

---

<div class="post-metadata">

**Author:** ![simon-mo](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/simon-mo/32/9_2.png) [@simon-mo](https://discuss.ray.io/u/simon-mo)\
**Post date:** [January 22, 2021, 8:53pm UTC](https://discuss.ray.io/t/multiple-jobs-with-different-dependencies/548/4 "2021-01-22T20:53:29Z")

</div>

We currently only have this **experimental** API for actor. You can use

```python
Actor.options(override_environment_variables={"KEY": "VALUE"}).remote()

```

to override environment variable for an actor and all the tasks/actors it subsequently launches.

---

<div class="post-metadata">

**Author:** ![sangcho](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/sangcho/32/425_2.png) [@sangcho](https://discuss.ray.io/u/sangcho)\
**Post date:** [January 22, 2021, 8:59pm UTC](https://discuss.ray.io/t/multiple-jobs-with-different-dependencies/548/5 "2021-01-22T20:59:44Z")

</div>

It is also possible to set the environment variables per job using

```auto
from ray.job_config import JobConfig
ray.init(job_config=JobConfig(worker_env={"EnvKey": "EnvVar"}))

```

This will set the environment variables for all workers used for the job (Note: Same workers are not shared among jobs).

---

<div class="post-metadata">

**Author:** ![sangcho](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/sangcho/32/425_2.png) [@sangcho](https://discuss.ray.io/u/sangcho)\
**Post date:** [January 22, 2021, 9:07pm UTC](https://discuss.ray.io/t/multiple-jobs-with-different-dependencies/548/6 "2021-01-22T21:07:57Z")

</div>

@raghukiran It will be really awesome if you can share your experience with this API. We can probably consider creating more higher level APIs (which Ray.Serve already did with Simon’s per-actor env variable)

---

<div class="post-metadata">

**Author:** ![raghukiran](https://avatars.discourse-cdn.com/v4/letter/r/e68b1a/32.png) [@raghukiran](https://discuss.ray.io/u/raghukiran)\
**Post date:** [January 22, 2021, 9:08pm UTC](https://discuss.ray.io/t/multiple-jobs-with-different-dependencies/548/7 "2021-01-22T21:08:07Z")

</div>

great - thanks @sangcho and @simon-mo - will def try it out! Appreciate your prompt responses!
