Skip to content

[runtime env] remove the API ray.runtime_env.get_current_runtime_env - #22620

Closed
SongGuyang wants to merge 2 commits into
ray-project:masterfrom
antgroup:dev_runtime_env_api
Closed

SongGuyang wants to merge 2 commits into
ray-project:masterfrom
antgroup:dev_runtime_env_api

Conversation

@SongGuyang

Copy link
Copy Markdown
Contributor

Why are these changes needed?

Remove the API ray.runtime_env.get_current_runtime_env() and use ray.get_runtime_context().runtime_env instead.

Related issue number

#22594

Checks

@SongGuyang
SongGuyang requested a review from edoakes February 24, 2022 11:15
@SongGuyang

Copy link
Copy Markdown
Contributor Author

@edoakes There is a new issue I want to discuss:
Currently, ray.get_runtime_context().runtime_env return a new dict instance so we can modify it directly for inheritance. Like:

Actor.options(runtime_env=ray.get_runtime_context().runtime_env.update(
            {"env_vars": {"A": "a", "B": "b"}}))

This use case is a little weird because runtime_env is a property API which often be seen as a reference. So, do we need to add a new API in runtime_context? Like:

Actor.options(runtime_env=ray.get_runtime_context().get_runtime_env().update(
            {"env_vars": {"A": "a", "B": "b"}}))

@edoakes

edoakes commented Feb 24, 2022

Copy link
Copy Markdown
Collaborator

@SongGuyang it's not safe to return a reference to the worker's runtime_env anyways (don't want users messing with it), so I think let's just document that it returns a copy

@edoakes

edoakes commented Feb 24, 2022

Copy link
Copy Markdown
Collaborator

linter failing on docs

@edoakes

edoakes commented Mar 1, 2022 •

Copy link
Copy Markdown
Collaborator

@SongGuyang ping to fix tests and get this merged

@SongGuyang

Copy link
Copy Markdown
Contributor Author

@edoakes do we still need this PR? The previous PR has been reverted.

@edoakes

edoakes commented Mar 2, 2022

Copy link
Copy Markdown
Collaborator

Yes we should still merge this; it updates tests and removes the currently unused code

@edoakes

edoakes commented Mar 2, 2022

Copy link
Copy Markdown
Collaborator

Oh, sorry, now I realize that this makes no sense after the revert.... I was just looking at the diff but didn't realize it doesn't apply to master. My bad.

@edoakes edoakes closed this Mar 2, 2022
@SongGuyang

Copy link
Copy Markdown
Contributor Author

OK.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants