Skip to content

[runtime env] support create or delete runtime envs in agent - #15904

Merged
raulchen merged 21 commits into
ray-project:masterfrom
antgroup:dev_runtime_env
Jun 9, 2021
Merged

raulchen merged 21 commits into
ray-project:masterfrom
antgroup:dev_runtime_env

Conversation

@SongGuyang

@SongGuyang SongGuyang commented May 19, 2021 •

Copy link
Copy Markdown
Contributor

Why are these changes needed?

  • Support create or delete runtime env from raylet to agent.
  • The new rpc is triggered by PopWorker of worker_pool.
  • Add uris to serialized_runtime_env of task spec to ensure runtime env creating could be triggered.
  • This PR is not a complete implementation. Some future issues:
    • Try ensure_runtime_env_setup(uris) to download packages in agent.
    • Delete runtime env local files in agent.
    • Reschedule to other nodes when create runtime env failed. We can make PopWorker to be a async function.

Related issue number

#15696

@SongGuyang SongGuyang changed the title support runtime env agent [WIP]support runtime env agent May 19, 2021
@edoakes edoakes assigned architkulkarni and unassigned edoakes May 19, 2021
Comment thread src/ray/raylet/worker_pool.cc Resolved
@edoakes

edoakes commented May 19, 2021

Copy link
Copy Markdown
Collaborator

@SongGuyang please merge latest master, @architkulkarni recently update the worker caching logic in worker_pool.cc to properly handle runtime_envs

@SongGuyang SongGuyang changed the title [WIP]support runtime env agent support runtime env agent May 20, 2021
@SongGuyang SongGuyang changed the title support runtime env agent [runtime env] support runtime env agent May 20, 2021
@SongGuyang SongGuyang changed the title [runtime env] support runtime env agent [runtime env] support create or delete runtime envs in agent May 20, 2021
@SongGuyang

Copy link
Copy Markdown
Contributor Author

@edoakes Code has been updated. Please help to review. @architkulkarni @iycheng

@SongGuyang
SongGuyang requested a review from fyrestone May 20, 2021 13:17
@edoakes

edoakes commented May 21, 2021

Copy link
Copy Markdown
Collaborator

@SongGuyang we are pushing for an internal deadline this coming Monday so we might be slower than usual to respond to PRs. I will let @architkulkarni @iycheng review this when they have a chance!

@SongGuyang

Copy link
Copy Markdown
Contributor Author

@edoakes OK, no problem.

Comment thread python/ray/_private/runtime_env.py Resolved
Comment thread src/ray/raylet/agent_manager.h Resolved
Comment thread src/ray/raylet/node_manager.cc Resolved
Comment thread src/ray/common/ray_config_def.h Resolved
Comment thread src/ray/raylet/worker_pool.cc Resolved
Comment thread src/ray/raylet/worker_pool.cc Resolved
@fishbone

Copy link
Copy Markdown
Contributor

I'm thinking about the cleanup step introduced by the agent manager. Right now the cleanup is carefully designed to be:

  • if there is no referencing to some object, move it and delete it in another process (util worker before). The reason we did mv first is to avoid race conditions.
  • and the downloading happens after the connection, which is also to avoid race condition. it increases the counting by 1 first (like locking) and then downloading.

I'm wondering will we follow the same pattern here? or we'll introduce something better? If downloading and uploading happens both in agent, should the agent manage the referencing of the uris?

@SongGuyang

Copy link
Copy Markdown
Contributor Author

@iycheng Maybe agent should manage referencing. But raylet should trigger the increase and decrease of references when job stopped or actor killed.

@architkulkarni architkulkarni left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me! I don't have merge privileges so I'll let @edoakes handle it from here

@SongGuyang

Copy link
Copy Markdown
Contributor Author

@architkulkarni Thanks. @edoakes Can we merge this?

@edoakes edoakes left a comment •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@SongGuyang it looks like we don't have any tests for this, could you add some basic tests before we merge? If possible, it'd be ideal if we had a feature flag and ran the existing test with the feature flag on and off but it seems that will require implementing more features. In that case just some basic unit tests are fine.

@SongGuyang

Copy link
Copy Markdown
Contributor Author

@edoakes Sorry for late update. I have updated some unit tests to worker_pool_test. And we can trust test_runtime_env.py to be a integration testing. If the runtime env agent rpc failed, the integration testing will be failed now. But we need more PRs to make the feature completed. More test code will be added in future PRs.

@SongGuyang

Copy link
Copy Markdown
Contributor Author

@edoakes Sorry for late update. I have updated some unit tests to worker_pool_test. And I think we can trust test_runtime_env.py to be the integration testing because this testing will be failed when the runtime env agent rpc failed now. But we need some other PRs to make this feature completed. So we will add more test code in future PRs.
Please help to review and merge it if it look good for you. Thank you.

@architkulkarni

Copy link
Copy Markdown
Contributor

Thanks so much for adding these tests! We are currently pushing for the Ray 1.4 release so our review may be slower than usual again--sorry about that. We'll try to review it as soon as we can

@SongGuyang

Copy link
Copy Markdown
Contributor Author

@architkulkarni OK. Thanks.

Comment thread src/ray/raylet/agent_manager.cc Resolved
Comment thread src/ray/raylet/agent_manager.cc Resolved
Comment thread src/ray/raylet/agent_manager.cc Resolved
Comment thread src/ray/raylet/node_manager.cc Resolved
Comment thread src/ray/raylet/worker_pool.cc Resolved
Comment thread src/ray/raylet/agent_manager.h Resolved
Comment thread dashboard/agent.py Resolved
Comment thread dashboard/agent.py Resolved
Comment thread src/ray/common/ray_config_def.h Resolved
Comment thread src/ray/raylet/agent_manager.cc Resolved
Comment thread src/ray/raylet/agent_manager.h Resolved
Comment thread src/ray/raylet/worker_pool.cc Resolved
Comment thread src/ray/raylet/worker_pool.h Resolved
Comment thread src/ray/raylet/agent_manager.h Resolved
@architkulkarni

Copy link
Copy Markdown
Contributor

I reviewed the test, and it looks great, thanks for adding it @SongGuyang! It looks like you've also tested that the runtime env hashing works as expected, and your framework will make it easy for me to add more tests later. I agree that the existing Python tests can serve as integration testing. Thanks also @raulchen for the careful review.

This PR looks good to me, but perhaps we can also get an approval from @iycheng or @edoakes who might have more experience with gRPC?

Comment thread src/ray/raylet/worker_pool.h Resolved
Comment thread src/ray/raylet/worker_pool.h Resolved
@raulchen

raulchen commented Jun 9, 2021

Copy link
Copy Markdown
Contributor

HI, @architkulkarni the gRPC changes are totally fine. They are just boilerplate code.
I've carefully reviewed this PR a few times. And it should be good to merge. I'm going to merge it after CI passes to unblock the follow-up PRs (@SongGuyang already has a new PR that depends on this one).

@raulchen
raulchen merged commit 874e947 into ray-project:master Jun 9, 2021
@raulchen
raulchen deleted the dev_runtime_env branch June 9, 2021 12:22
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.

5 participants