Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[core][c++ worker]Add namespace support for c++ worker #26327

Merged
merged 8 commits into from
Jul 12, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix test and add more
  • Loading branch information
WangTaoTheTonic committed Jul 8, 2022
commit 25310481bd699aba0e6d52ac6980e3e9ff7e9c57
28 changes: 22 additions & 6 deletions cpp/src/ray/test/cluster/cluster_mode_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -481,20 +481,36 @@ TEST(RayClusterModeTest, TaskWithPlacementGroup) {

TEST(RayClusterModeTest, NamespaceTest) {
// Create a named actor in namespace `isolated_ns`.
std::string actor_name = "named_actor";
std::string ns_name = "isolated_ns";
std::string actor_name_in_isolated_ns = "named_actor_in_isolated_ns";
std::string isolated_ns_name = "isolated_ns";
ray::ActorHandle<Counter> actor =
ray::Actor(RAY_FUNC(Counter::FactoryCreate)).SetName(actor_name, ns_name).Remote();
ray::Actor(RAY_FUNC(Counter::FactoryCreate))
.SetName(actor_name_in_isolated_ns, isolated_ns_name)
.Remote();
auto initialized_obj = actor.Task(&Counter::Initialized).Remote();
EXPECT_TRUE(*initialized_obj.Get());
// It is invisible to job default namespace.
auto actor_optional = ray::GetActor<Counter>(actor_name);
auto actor_optional = ray::GetActor<Counter>(actor_name_in_isolated_ns);
EXPECT_TRUE(!actor_optional);
// It is visible to the namespace it belongs.
actor_optional = ray::GetActor<Counter>(actor_name, ns_name);
actor_optional = ray::GetActor<Counter>(actor_name_in_isolated_ns, isolated_ns_name);
EXPECT_TRUE(actor_optional);
// It is invisible to any other namespaces.
actor_optional = ray::GetActor<Counter>(actor_name_in_isolated_ns, "other_ns");
EXPECT_TRUE(!actor_optional);

// Create a named actor in job default namespace.
std::string actor_name_in_default_ns = "actor_name_in_default_ns";
actor = ray::Actor(RAY_FUNC(Counter::FactoryCreate))
.SetName(actor_name_in_default_ns)
.Remote();
initialized_obj = actor.Task(&Counter::Initialized).Remote();
EXPECT_TRUE(*initialized_obj.Get());
// It is visible to job default namespace.
actor_optional = ray::GetActor<Counter>(actor_name_in_default_ns);
EXPECT_TRUE(actor_optional);
// It is invisible to any other namespaces.
actor_optional = ray::GetActor<Counter>(actor_name, "other_ns");
actor_optional = ray::GetActor<Counter>(actor_name_in_default_ns, isolated_ns_name);
EXPECT_TRUE(!actor_optional);
}

Expand Down