Skip to content

Commit c58c37c

Browse files
committed
Merge remote-tracking branch 'origin/master' into lonnie-260206-jobstate
2 parents 93e1491 + f3d444a commit c58c37c

File tree

9 files changed

+0
-165
lines changed

9 files changed

+0
-165
lines changed

python/ray/_private/debug_api.py

Lines changed: 0 additions & 12 deletions
This file was deleted.

python/ray/_raylet.pyx

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4616,17 +4616,6 @@ cdef class CoreWorker:
46164616

46174617
return ref_counts
46184618

4619-
def get_reference_counter_debug_json(self):
4620-
"""Returns a JSON string of the internal state of the ReferenceCounter.
4621-
4622-
NOTE: This is NOT a stable API. It should only be used for debugging and
4623-
NEVER in tests or production code.
4624-
"""
4625-
cdef:
4626-
c_string debug_json
4627-
debug_json = CCoreWorkerProcess.GetCoreWorker().GetReferenceCounterDebugJson()
4628-
return debug_json.decode('utf-8')
4629-
46304619
def set_get_async_callback(self, ObjectRef object_ref, user_callback: Callable):
46314620
# NOTE: we need to manually increment the Python reference count to avoid the
46324621
# callback object being garbage collected before it's called by the core worker.

python/ray/includes/libcoreworker.pxd

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,6 @@ cdef extern from "ray/core_worker/core_worker.h" nogil:
328328
void YieldCurrentFiber(CFiberEvent &coroutine_done)
329329

330330
unordered_map[CObjectID, pair[size_t, size_t]] GetAllReferenceCounts()
331-
c_string GetReferenceCounterDebugJson() const
332331
c_vector[CTaskID] GetPendingChildrenTasks(const CTaskID &task_id) const
333332

334333
void GetAsync(const CObjectID &object_id,

src/ray/core_worker/BUILD.bazel

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,6 @@ ray_cc_library(
169169
"//src/ray/util:network_util",
170170
"@com_google_absl//absl/base:core_headers",
171171
"@com_google_absl//absl/synchronization",
172-
"@nlohmann_json",
173172
],
174173
)
175174

src/ray/core_worker/core_worker.cc

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -856,10 +856,6 @@ CoreWorker::GetAllReferenceCounts() const {
856856
return counts;
857857
}
858858

859-
std::string CoreWorker::GetReferenceCounterDebugJson() const {
860-
return reference_counter_->ToJsonString();
861-
}
862-
863859
std::vector<TaskID> CoreWorker::GetPendingChildrenTasks(const TaskID &task_id) const {
864860
return task_manager_->GetPendingChildrenTasks(task_id);
865861
}

src/ray/core_worker/core_worker.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -398,12 +398,6 @@ class CoreWorker : public std::enable_shared_from_this<CoreWorker> {
398398
/// (local, submitted_task) reference counts. For debugging purposes.
399399
std::unordered_map<ObjectID, std::pair<size_t, size_t>> GetAllReferenceCounts() const;
400400

401-
/// Returns a JSON string representation of the internal state of the
402-
/// ReferenceCounter.
403-
/// NOTE: This is very expensive and must only be used for debugging.
404-
/// Please do NOT use this for production observability or testing.
405-
std::string GetReferenceCounterDebugJson() const;
406-
407401
/// Return all pending children task ids for a given parent task id.
408402
/// The parent task id should exist in the current worker.
409403
/// For debugging and testing only.

src/ray/core_worker/reference_counter.cc

Lines changed: 0 additions & 117 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
#include "ray/core_worker/reference_counter.h"
1616

1717
#include <memory>
18-
#include <nlohmann/json.hpp>
1918
#include <string>
2019
#include <unordered_map>
2120
#include <unordered_set>
@@ -25,52 +24,6 @@
2524
#include "ray/util/logging.h"
2625
#include "ray/util/network_util.h"
2726

28-
using json = nlohmann::json;
29-
30-
namespace {
31-
32-
json AddressToJson(const ray::rpc::Address &address) {
33-
return {
34-
{"node_id", ray::NodeID::FromBinary(address.node_id()).Hex()},
35-
{"ip_address", address.ip_address()},
36-
{"port", address.port()},
37-
{"worker_id", ray::WorkerID::FromBinary(address.worker_id()).Hex()},
38-
};
39-
}
40-
41-
template <class Container>
42-
json IdContainerToJsonArray(const Container &c) {
43-
json output = json::array();
44-
for (const auto &id : c) {
45-
output.push_back(id.Hex());
46-
}
47-
return output;
48-
}
49-
50-
constexpr const char *LineageReconstructionEligibilityToString(
51-
ray::core::LineageReconstructionEligibility lre) noexcept {
52-
switch (lre) {
53-
case ray::core::LineageReconstructionEligibility::ELIGIBLE:
54-
return "ELIGIBLE";
55-
case ray::core::LineageReconstructionEligibility::INELIGIBLE_PUT:
56-
return "INELIGIBLE_PUT";
57-
case ray::core::LineageReconstructionEligibility::INELIGIBLE_NO_RETRIES:
58-
return "INELIGIBLE_NO_RETRIES";
59-
case ray::core::LineageReconstructionEligibility::INELIGIBLE_LOCAL_MODE:
60-
return "INELIGIBLE_LOCAL_MODE";
61-
case ray::core::LineageReconstructionEligibility::INELIGIBLE_LINEAGE_EVICTED:
62-
return "INELIGIBLE_LINEAGE_EVICTED";
63-
case ray::core::LineageReconstructionEligibility::INELIGIBLE_LINEAGE_DISABLED:
64-
return "INELIGIBLE_LINEAGE_DISABLED";
65-
case ray::core::LineageReconstructionEligibility::INELIGIBLE_REF_NOT_FOUND:
66-
return "INELIGIBLE_REF_NOT_FOUND";
67-
default:
68-
return "UNKNOWN";
69-
};
70-
};
71-
72-
}; // namespace
73-
7427
#define PRINT_REF_COUNT(it) \
7528
RAY_LOG(DEBUG) << "REF " << it->first << ": " << it->second.DebugString();
7629

@@ -1813,76 +1766,6 @@ std::string ReferenceCounter::DebugString() const {
18131766
return ss.str();
18141767
}
18151768

1816-
json ReferenceCounter::NestedReferenceCount::ToJson() const {
1817-
return {
1818-
{"contained_in_owned", IdContainerToJsonArray(contained_in_owned)},
1819-
{"contained_in_borrowed_ids", IdContainerToJsonArray(contained_in_borrowed_ids)},
1820-
{"contains", IdContainerToJsonArray(contains)}};
1821-
}
1822-
1823-
json ReferenceCounter::BorrowInfo::ToJson() const {
1824-
json stored_in_objects_json = json::array();
1825-
for (const auto &[object_id, addr] : stored_in_objects) {
1826-
stored_in_objects_json.push_back(
1827-
{{"object_id", object_id.Hex()}, {"address", AddressToJson(addr)}});
1828-
}
1829-
json borrowers_json = json::array();
1830-
for (const auto &address : borrowers) {
1831-
borrowers_json.push_back(AddressToJson(address));
1832-
}
1833-
return {{"stored_in_objects", stored_in_objects_json}, {"borrowers", borrowers_json}};
1834-
}
1835-
1836-
std::string ReferenceCounter::ToJsonString() const {
1837-
absl::MutexLock lock(&mutex_);
1838-
json ref_table_json = json::array();
1839-
for (const auto &[obj_id, reference] : object_id_refs_) {
1840-
ref_table_json.push_back({
1841-
{"object_id", obj_id.Hex()},
1842-
{"reference", reference.ToJson()},
1843-
});
1844-
}
1845-
json output = {{"rpc_address", AddressToJson(rpc_address_)},
1846-
{"reference_table", ref_table_json},
1847-
{"freed_objects", IdContainerToJsonArray(freed_objects_)},
1848-
{"reconstructable_owned_objects",
1849-
IdContainerToJsonArray(reconstructable_owned_objects_)},
1850-
{"objects_to_recover", IdContainerToJsonArray(objects_to_recover_)}};
1851-
return output.dump();
1852-
}
1853-
1854-
json ReferenceCounter::Reference::ToJson() const {
1855-
return {
1856-
{"call_site", call_site_},
1857-
{"object_size", object_size_},
1858-
{"locations", IdContainerToJsonArray(locations)},
1859-
{"owner_address", owner_address_ ? AddressToJson(*owner_address_) : json(nullptr)},
1860-
{"pinned_at_node_id",
1861-
pinned_at_node_id_ ? json(pinned_at_node_id_->Hex()) : json(nullptr)},
1862-
{"tensor_transport", tensor_transport_ ? json(*tensor_transport_) : json(nullptr)},
1863-
{"owned_by_us", owned_by_us_},
1864-
{"lineage_eligibility",
1865-
LineageReconstructionEligibilityToString(lineage_eligibility_)},
1866-
{"lineage_ref_count", lineage_ref_count},
1867-
{"local_ref_count", local_ref_count},
1868-
{"submitted_task_ref_count", submitted_task_ref_count},
1869-
{"nested_reference_count",
1870-
nested_reference_count ? nested_reference_count->ToJson() : json(nullptr)},
1871-
{"borrow_info", borrow_info ? borrow_info->ToJson() : json(nullptr)},
1872-
{"num_object_out_of_scope_or_freed_callbacks",
1873-
on_object_out_of_scope_or_freed_callbacks.size()},
1874-
{"num_object_ref_deleted_callbacks", object_ref_deleted_callbacks.size()},
1875-
{"publish_ref_removed", publish_ref_removed},
1876-
{"spilled_url", spilled_url},
1877-
{"spilled_node_id", spilled_node_id.Hex()},
1878-
{"spilled", spilled},
1879-
{"foreign_owner_already_monitoring", foreign_owner_already_monitoring},
1880-
{"has_nested_refs_report", has_nested_refs_to_report},
1881-
{"pending_creation", pending_creation_},
1882-
{"did_spill", did_spill},
1883-
};
1884-
}
1885-
18861769
std::string ReferenceCounter::Reference::DebugString() const {
18871770
std::stringstream ss;
18881771
ss << "Reference{borrowers: " << borrow().borrowers.size()

src/ray/core_worker/reference_counter.h

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616

1717
#include <list>
1818
#include <memory>
19-
#include <nlohmann/json.hpp>
2019
#include <string>
2120
#include <unordered_map>
2221
#include <unordered_set>
@@ -183,8 +182,6 @@ class ReferenceCounter : public ReferenceCounterInterface,
183182

184183
std::string DebugString() const override ABSL_LOCKS_EXCLUDED(mutex_);
185184

186-
std::string ToJsonString() const override ABSL_LOCKS_EXCLUDED(mutex_);
187-
188185
void PopAndClearLocalBorrowers(const std::vector<ObjectID> &borrowed_ids,
189186
ReferenceTableProto *proto,
190187
std::vector<ObjectID> *deleted) override
@@ -282,8 +279,6 @@ class ReferenceCounter : public ReferenceCounterInterface,
282279
/// 2. We call ray.get() on an ID whose contents we do not know and we
283280
/// discover that it contains these IDs.
284281
absl::flat_hash_set<ObjectID> contains;
285-
286-
nlohmann::json ToJson() const;
287282
};
288283

289284
/// Contains information related to borrowing only.
@@ -307,8 +302,6 @@ class ReferenceCounter : public ReferenceCounterInterface,
307302
/// borrowers. A borrower is removed from the list when it responds
308303
/// that it is no longer using the reference.
309304
absl::flat_hash_set<rpc::Address> borrowers;
310-
311-
nlohmann::json ToJson() const;
312305
};
313306

314307
struct Reference {
@@ -429,7 +422,6 @@ class ReferenceCounter : public ReferenceCounterInterface,
429422
}
430423

431424
std::string DebugString() const;
432-
nlohmann::json ToJson() const;
433425

434426
/// Description of the call site where the reference was created.
435427
std::string call_site_ = "<unknown>";

src/ray/core_worker/reference_counter_interface.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -387,11 +387,6 @@ class ReferenceCounterInterface {
387387

388388
virtual std::string DebugString() const = 0;
389389

390-
/// Converts the entire private state into a JSON string.
391-
/// NOTE: This is a very expensive method. It is only available for debugging.
392-
/// Do not use it for production observability or testing.
393-
virtual std::string ToJsonString() const = 0;
394-
395390
/// Populate a table with ObjectIDs that we were or are still borrowing.
396391
/// This should be called when a task returns, and the argument should be any
397392
/// IDs that were passed by reference in the task spec or that were

0 commit comments

Comments
 (0)