question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[RFC] Change the behavior of Runtime Environments inheritance

See original GitHub issue

Hi all: Runtime Environments is already GA in Ray 1.6.0. The latest doc is here. And now, we already supported a inheritance behavior as follows (copied from the doc):

  • The runtime_env[“env_vars”] field will be merged with the runtime_env[“env_vars”] field of the parent. This allows for environment variables set in the parent’s runtime environment to be automatically propagated to the child, even if new environment variables are set in the child’s runtime environment.
  • Every other field in the runtime_env will be overridden by the child, not merged. For example, if runtime_env[“py_modules”] is specified, it will replace the runtime_env[“py_modules”] field of the parent.

For example, if the parent runtime env is:

{
   "py_modules": "s3://ab.zip",
    "pip": ["requests", "pendulum==2.1.2"],
    "env_vars":{
        "a":"b",
    }
}

and the child runtime env is:

{
   "py_modules": "s3://cd.zip",
    "env_vars":{
        "c":"d",
    }
}

The final merged runtime env for child is:

{
   "py_modules": "s3://cd.zip",
    "pip": ["requests", "pendulum==2.1.2"],
    "env_vars":{
        "a":"b",
        "c":"d",
    }
}

We think this runtime env merging logic is so complex and confusing to users because users can’t know the final runtime env before the jobs are run.

Another case is that If you set a special conda env in parent actor and set a special pip env in child actor, you will get a ValueError exception because conda and pip are conflicting.

So, we want to do a refactor and change the behavior of Runtime Environments inheritance. Here is the new behavior:

  • If there is no runtime env option when we create actor, inherit the parent runtime env.
  • Otherwise, use the optional runtime env directly and don’t do the merging.

We think the behavior above could cover more than 90% scenes. If you really want to do a specific merging from parent runtime env, you can use a new API named ray.get_current_runtime_env() to get the parent runtime env and modify this dict by yourself. Like: Actor.options(runtime_env=ray.get_current_runtime_env().update({"X": "Y"}))

Refer to some discuss in issue https://github.com/ray-project/ray/issues/21494.

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:5
  • Comments:12 (11 by maintainers)

github_iconTop GitHub Comments

1reaction
edoakescommented, Jan 25, 2022

I think this behavior is reasonable and simplifies the mental model, while still allowing libraries and advanced users to achieve today’s functionality.

My only concern is that this is going to be a breaking change for some users. If we do this, it needs to be well documented and ideally we would raise a useful warning message in the cases where behaviors have changed (I’m not sure if that’s possible to detect though).

1reaction
rkooo567commented, Jan 24, 2022

Since it is already GA, I added core-api-change-approval. cc @ericl @edoakes please review it!

Read more comments on GitHub >

github_iconTop Results From Across the Web

RFC 8353: Generic Security Service API Version 2: Java ...
1. Static Constants public static final Oid NT_HOSTBASED_SERVICE OID indicating a host-based service name form. · 2. equals public boolean equals(GSSName another) ...
Read more >
RFC-0126: Driver Runtime - Fuchsia
This RFC establishes the design by which drivers colocated within a process will communicate with each other. Drivers will communicate via an in ......
Read more >
JDK 19 Release Notes, Important Changes, and Information
This document describes important changes and information of the JDK 19 ... Java programs can interoperate with code and data outside of the...
Read more >
Runtime Customization | Mendix Documentation
Defines whether to update the web service user's LastLogin field on each login. When this happens a database update query has to be...
Read more >
Issues · ray-project/ray · GitHub
Ray consists of a core distributed runtime and a toolkit of libraries (Ray AIR) for ... [RFC] Change the behavior of Runtime Environments...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found