Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix naming and comments
Browse files Browse the repository at this point in the history
Signed-off-by: sule <[email protected]>
xsuler committed Dec 24, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
1 parent 06d2fa6 commit 4ba2bbc
Showing 5 changed files with 13 additions and 14 deletions.
3 changes: 2 additions & 1 deletion python/ray/dashboard/modules/job/job_head.py
Original file line number Diff line number Diff line change
@@ -622,7 +622,8 @@ async def _create_job_cluster(self, job_id, virtual_cluster_id, replica_sets):
reply = await (self._gcs_virtual_cluster_info_stub.CreateJobCluster(request))
if reply.status.code != 0:
logger.warning(
f"failed to create job cluster for {job_id} in {virtual_cluster_id}"
f"failed to create job cluster for {job_id} in"
f" {virtual_cluster_id}, message: {reply.status.message}"
)
return None
return reply.job_cluster_id
4 changes: 2 additions & 2 deletions src/ray/common/virtual_cluster_id.h
Original file line number Diff line number Diff line change
@@ -25,8 +25,8 @@ class VirtualClusterID : public SimpleID<VirtualClusterID> {
public:
using SimpleID::SimpleID;

VirtualClusterID BuildJobClusterID(const std::string &job_name) const {
return VirtualClusterID::FromBinary(id_ + kJobClusterIDSeperator + job_name);
VirtualClusterID BuildJobClusterID(const std::string &job_id) const {
return VirtualClusterID::FromBinary(id_ + kJobClusterIDSeperator + job_id);
}

bool IsJobClusterID() const {
6 changes: 3 additions & 3 deletions src/ray/gcs/gcs_server/gcs_virtual_cluster.h
Original file line number Diff line number Diff line change
@@ -226,10 +226,10 @@ class ExclusiveCluster : public VirtualCluster {

/// Build the job cluster id.
///
/// \param job_name The name of the job.
/// \param job_id The name of the job.
/// \return The job cluster id.
std::string BuildJobClusterID(const std::string &job_name) {
return VirtualClusterID::FromBinary(GetID()).BuildJobClusterID(job_name).Binary();
std::string BuildJobClusterID(const std::string &job_id) {
return VirtualClusterID::FromBinary(GetID()).BuildJobClusterID(job_id).Binary();
}

/// Create a job cluster.
12 changes: 5 additions & 7 deletions src/ray/gcs/gcs_server/gcs_virtual_cluster_manager.cc
Original file line number Diff line number Diff line change
@@ -131,18 +131,16 @@ void GcsVirtualClusterManager::HandleCreateJobCluster(
auto virtual_cluster = GetVirtualCluster(virtual_cluster_id);
if (virtual_cluster == nullptr) {
GCS_RPC_SEND_REPLY(
send_reply_callback, reply, Status::Invalid("virtual cluster not exists"));
send_reply_callback, reply, Status::NotFound("virtual cluster not exists"));
return;
}
if (virtual_cluster->GetMode() != rpc::AllocationMode::EXCLUSIVE) {
GCS_RPC_SEND_REPLY(
send_reply_callback, reply, Status::Invalid("virtual cluster is not exclusive"));
GCS_RPC_SEND_REPLY(send_reply_callback,
reply,
Status::InvalidArgument("virtual cluster is not exclusive"));
return;
}
ReplicaSets replica_sets;
for (const auto &[template_id, count] : request.replica_sets()) {
replica_sets[template_id] = count;
}
ReplicaSets replica_sets(request.replica_sets().begin(), request.replica_sets().end());

auto exclusive_cluster = dynamic_cast<ExclusiveCluster *>(virtual_cluster.get());
const std::string &job_cluster_id =
2 changes: 1 addition & 1 deletion src/ray/protobuf/gcs_service.proto
Original file line number Diff line number Diff line change
@@ -864,7 +864,7 @@ message GetVirtualClustersReply {
message CreateJobClusterRequest {
// The job id.
string job_id = 1;
// The virtual cluster id.
// ID of the virtual cluster that the job belongs to.
string virtual_cluster_id = 2;
// The replica set of the job cluster.
map<string, int32> replica_sets = 3;

0 comments on commit 4ba2bbc

Please sign in to comment.