mirror of
https://github.com/vale981/ray
synced 2025-03-06 10:31:39 -05:00
This reverts commit 7e013366ac
.
This commit is contained in:
parent
f65cc72b4c
commit
7a18d90a25
3 changed files with 9 additions and 50 deletions
|
@ -341,12 +341,6 @@ const NodeResources &ClusterResourceScheduler::GetLocalNodeResources() const {
|
|||
return node_it->second.GetLocalView();
|
||||
}
|
||||
|
||||
NodeResources *ClusterResourceScheduler::GetMutableLocalNodeResources() {
|
||||
auto node_it = nodes_.find(local_node_id_);
|
||||
RAY_CHECK(node_it != nodes_.end());
|
||||
return node_it->second.GetMutableLocalView();
|
||||
}
|
||||
|
||||
int64_t ClusterResourceScheduler::NumNodes() const { return nodes_.size(); }
|
||||
|
||||
const StringIdMap &ClusterResourceScheduler::GetStringIdMap() const {
|
||||
|
@ -961,15 +955,6 @@ void ClusterResourceScheduler::UpdateLastResourceUsage(
|
|||
}
|
||||
|
||||
void ClusterResourceScheduler::FillResourceUsage(rpc::ResourcesData &resources_data) {
|
||||
// Update local object store usage and report to other raylets.
|
||||
if (get_used_object_store_memory_ != nullptr) {
|
||||
auto &capacity =
|
||||
GetMutableLocalNodeResources()->predefined_resources[OBJECT_STORE_MEM];
|
||||
double used = get_used_object_store_memory_();
|
||||
double total = capacity.total.Double();
|
||||
capacity.available = FixedPoint(total >= used ? total - used : 0.0);
|
||||
}
|
||||
|
||||
NodeResources resources;
|
||||
|
||||
RAY_CHECK(GetNodeResources(local_node_id_, &resources))
|
||||
|
@ -993,6 +978,15 @@ void ClusterResourceScheduler::FillResourceUsage(rpc::ResourcesData &resources_d
|
|||
}
|
||||
}
|
||||
|
||||
// Automatically report object store usage.
|
||||
// XXX: this MUTATES the resources field, which is needed since we are storing
|
||||
// it in last_report_resources_.
|
||||
if (get_used_object_store_memory_ != nullptr) {
|
||||
auto &capacity = resources.predefined_resources[OBJECT_STORE_MEM];
|
||||
double used = get_used_object_store_memory_();
|
||||
capacity.available = FixedPoint(capacity.total.Double() - used);
|
||||
}
|
||||
|
||||
for (int i = 0; i < PredefinedResources_MAX; i++) {
|
||||
const auto &label = ResourceEnumToString((PredefinedResources)i);
|
||||
const auto &capacity = resources.predefined_resources[i];
|
||||
|
|
|
@ -412,9 +412,6 @@ class ClusterResourceScheduler : public ClusterResourceSchedulerInterface {
|
|||
bool SubtractRemoteNodeAvailableResources(int64_t node_id,
|
||||
const ResourceRequest &resource_request);
|
||||
|
||||
/// Get mutable local node resources.
|
||||
NodeResources *GetMutableLocalNodeResources();
|
||||
|
||||
/// The threshold at which to switch from packing to spreading.
|
||||
const float spread_threshold_;
|
||||
/// List of nodes in the clusters and their resources organized as a map.
|
||||
|
|
|
@ -1092,14 +1092,6 @@ TEST_F(ClusterResourceSchedulerTest, ObjectStoreMemoryUsageTest) {
|
|||
auto total = data.resources_total();
|
||||
ASSERT_EQ(available["object_store_memory"], 750 * 1024 * 1024);
|
||||
ASSERT_EQ(total["object_store_memory"], 1000 * 1024 * 1024);
|
||||
ASSERT_EQ(resource_scheduler.GetLocalNodeResources()
|
||||
.predefined_resources[OBJECT_STORE_MEM]
|
||||
.available.Double(),
|
||||
750 * 1024 * 1024);
|
||||
ASSERT_EQ(resource_scheduler.GetLocalNodeResources()
|
||||
.predefined_resources[OBJECT_STORE_MEM]
|
||||
.total.Double(),
|
||||
1000 * 1024 * 1024);
|
||||
}
|
||||
|
||||
used_object_store_memory = 450 * 1024 * 1024;
|
||||
|
@ -1109,14 +1101,6 @@ TEST_F(ClusterResourceSchedulerTest, ObjectStoreMemoryUsageTest) {
|
|||
auto available = data.resources_available();
|
||||
auto total = data.resources_total();
|
||||
ASSERT_EQ(available["object_store_memory"], 550 * 1024 * 1024);
|
||||
ASSERT_EQ(resource_scheduler.GetLocalNodeResources()
|
||||
.predefined_resources[OBJECT_STORE_MEM]
|
||||
.available.Double(),
|
||||
550 * 1024 * 1024);
|
||||
ASSERT_EQ(resource_scheduler.GetLocalNodeResources()
|
||||
.predefined_resources[OBJECT_STORE_MEM]
|
||||
.total.Double(),
|
||||
1000 * 1024 * 1024);
|
||||
}
|
||||
|
||||
used_object_store_memory = 0;
|
||||
|
@ -1126,14 +1110,6 @@ TEST_F(ClusterResourceSchedulerTest, ObjectStoreMemoryUsageTest) {
|
|||
auto available = data.resources_available();
|
||||
auto total = data.resources_total();
|
||||
ASSERT_EQ(available["object_store_memory"], 1000 * 1024 * 1024);
|
||||
ASSERT_EQ(resource_scheduler.GetLocalNodeResources()
|
||||
.predefined_resources[OBJECT_STORE_MEM]
|
||||
.available.Double(),
|
||||
1000 * 1024 * 1024);
|
||||
ASSERT_EQ(resource_scheduler.GetLocalNodeResources()
|
||||
.predefined_resources[OBJECT_STORE_MEM]
|
||||
.total.Double(),
|
||||
1000 * 1024 * 1024);
|
||||
}
|
||||
|
||||
used_object_store_memory = 9999999999;
|
||||
|
@ -1143,14 +1119,6 @@ TEST_F(ClusterResourceSchedulerTest, ObjectStoreMemoryUsageTest) {
|
|||
auto available = data.resources_available();
|
||||
auto total = data.resources_total();
|
||||
ASSERT_EQ(available["object_store_memory"], 0);
|
||||
ASSERT_EQ(resource_scheduler.GetLocalNodeResources()
|
||||
.predefined_resources[OBJECT_STORE_MEM]
|
||||
.available.Double(),
|
||||
0);
|
||||
ASSERT_EQ(resource_scheduler.GetLocalNodeResources()
|
||||
.predefined_resources[OBJECT_STORE_MEM]
|
||||
.total.Double(),
|
||||
1000 * 1024 * 1024);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue