Skip to content

Commit 8430535

Browse files
author
davik
committed
Address doc related PR comments
Signed-off-by: davik <davik@anyscale.com>
1 parent 70764ff commit 8430535

File tree

8 files changed

+16
-22
lines changed

8 files changed

+16
-22
lines changed

src/ray/core_worker/core_worker.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2707,7 +2707,7 @@ Status CoreWorker::ExecuteTask(
27072707
std::vector<std::pair<ObjectID, std::shared_ptr<RayObject>>> *return_objects,
27082708
std::vector<std::pair<ObjectID, std::shared_ptr<RayObject>>> *dynamic_return_objects,
27092709
std::vector<std::pair<ObjectID, bool>> *streaming_generator_returns,
2710-
ReferenceCounter::ReferenceTableProto *borrowed_refs,
2710+
ReferenceCounterInterface::ReferenceTableProto *borrowed_refs,
27112711
bool *is_retryable_error,
27122712
std::string *application_error) {
27132713
RAY_LOG(DEBUG) << "Executing task, task info = " << task_spec.DebugString();
@@ -3082,7 +3082,7 @@ Status CoreWorker::ReportGeneratorItemReturns(
30823082
// we borrow the object. When the object value is allocatd, the
30833083
// memory store is updated. We should clear borrowers and memory store
30843084
// here.
3085-
ReferenceCounter::ReferenceTableProto borrowed_refs;
3085+
ReferenceCounterInterface::ReferenceTableProto borrowed_refs;
30863086
reference_counter_->PopAndClearLocalBorrowers(
30873087
{dynamic_return_object.first}, &borrowed_refs, &deleted);
30883088
memory_store_->Delete(deleted);
@@ -3152,7 +3152,7 @@ void CoreWorker::HandleReportGeneratorItemReturns(
31523152
std::vector<rpc::ObjectReference> CoreWorker::ExecuteTaskLocalMode(
31533153
const TaskSpecification &task_spec, const ActorID &actor_id) {
31543154
auto return_objects = std::vector<std::pair<ObjectID, std::shared_ptr<RayObject>>>();
3155-
auto borrowed_refs = ReferenceCounter::ReferenceTableProto();
3155+
auto borrowed_refs = ReferenceCounterInterface::ReferenceTableProto();
31563156

31573157
std::vector<rpc::ObjectReference> returned_refs;
31583158
size_t num_returns = task_spec.NumReturns();

src/ray/core_worker/core_worker.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1483,7 +1483,7 @@ class CoreWorker {
14831483
std::vector<std::pair<ObjectID, std::shared_ptr<RayObject>>>
14841484
*dynamic_return_objects,
14851485
std::vector<std::pair<ObjectID, bool>> *streaming_generator_returns,
1486-
ReferenceCounter::ReferenceTableProto *borrowed_refs,
1486+
ReferenceCounterInterface::ReferenceTableProto *borrowed_refs,
14871487
bool *is_retryable_error,
14881488
std::string *application_error);
14891489

src/ray/core_worker/reference_counter.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -960,7 +960,7 @@ ReferenceCounter::GetAllReferenceCounts() const {
960960

961961
void ReferenceCounter::PopAndClearLocalBorrowers(
962962
const std::vector<ObjectID> &borrowed_ids,
963-
ReferenceCounter::ReferenceTableProto *proto,
963+
ReferenceTableProto *proto,
964964
std::vector<ObjectID> *deleted) {
965965
absl::MutexLock lock(&mutex_);
966966
ReferenceProtoTable borrowed_refs;

src/ray/core_worker/reference_counter.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,6 @@ namespace core {
4343
class ReferenceCounter : public ReferenceCounterInterface,
4444
public LocalityDataProviderInterface {
4545
public:
46-
using ReferenceTableProto =
47-
::google::protobuf::RepeatedPtrField<rpc::ObjectReferenceCount>;
48-
using ReferenceRemovedCallback = std::function<void(const ObjectID &)>;
49-
using LineageReleasedCallback =
50-
std::function<int64_t(const ObjectID &, std::vector<ObjectID> *)>;
51-
5246
ReferenceCounter(rpc::Address rpc_address,
5347
pubsub::PublisherInterface *object_info_publisher,
5448
pubsub::SubscriberInterface *object_info_subscriber,

src/ray/core_worker/reference_counter_interface.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,10 @@
3030
namespace ray {
3131
namespace core {
3232

33-
// Interface for mocking.
3433
class ReferenceCounterInterface {
3534
public:
35+
using ReferenceTableProto =
36+
::google::protobuf::RepeatedPtrField<rpc::ObjectReferenceCount>;
3637
using LineageReleasedCallback =
3738
std::function<int64_t(const ObjectID &, std::vector<ObjectID> *)>;
3839

@@ -213,7 +214,6 @@ class ReferenceCounterInterface {
213214
/// if one exists. An outer_id may not exist if object_id was inlined
214215
/// directly in a task spec, or if it was passed in the application
215216
/// out-of-band.
216-
/// task ID (for non-actors) or the actor ID of the owner.
217217
/// \param[in] owner_address The owner's address.
218218
virtual bool AddBorrowedObject(const ObjectID &object_id,
219219
const ObjectID &outer_id,
@@ -241,7 +241,7 @@ class ReferenceCounterInterface {
241241

242242
//// Checks to see if objects have an owner.
243243
///
244-
/// \param[in] object_id The ID of the object.
244+
/// \param[in] object_ids The IDs of the objects.
245245
/// \return StatusT::OK if all objects have owners.
246246
/// \return StatusT::NotFound if any object does not have an owner. The error message
247247
/// contains objects without owners.

src/ray/core_worker/task_manager.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1329,7 +1329,7 @@ void TaskManager::FailPendingTask(const TaskID &task_id,
13291329
RemoveFinishedTaskReferences(spec,
13301330
/*release_lineage=*/true,
13311331
rpc::Address(),
1332-
ReferenceCounter::ReferenceTableProto());
1332+
ReferenceCounterInterface::ReferenceTableProto());
13331333

13341334
MarkTaskReturnObjectsFailed(spec, error_type, ray_error_info, store_in_plasma_ids);
13351335

@@ -1399,7 +1399,7 @@ void TaskManager::RemoveFinishedTaskReferences(
13991399
TaskSpecification &spec,
14001400
bool release_lineage,
14011401
const rpc::Address &borrower_addr,
1402-
const ReferenceCounter::ReferenceTableProto &borrowed_refs) {
1402+
const ReferenceCounterInterface::ReferenceTableProto &borrowed_refs) {
14031403
std::vector<ObjectID> plasma_dependencies = ExtractPlasmaDependencies(spec);
14041404

14051405
std::vector<ObjectID> return_ids;

src/ray/core_worker/task_manager.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -645,7 +645,7 @@ class TaskManager : public TaskManagerInterface {
645645
TaskSpecification &spec,
646646
bool release_lineage,
647647
const rpc::Address &worker_addr,
648-
const ReferenceCounter::ReferenceTableProto &borrowed_refs);
648+
const ReferenceCounterInterface::ReferenceTableProto &borrowed_refs);
649649

650650
/// Get the objects that were stored in plasma upon the first successful
651651
/// execution of this task. If the task is re-executed, these objects should

src/ray/core_worker/tests/reference_counter_test.cc

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ namespace ray {
3737
namespace core {
3838

3939
static const rpc::Address empty_borrower;
40-
static const ReferenceCounter::ReferenceTableProto empty_refs;
40+
static const ReferenceCounterInterface::ReferenceTableProto empty_refs;
4141

4242
class ReferenceCountTest : public ::testing::Test {
4343
protected:
@@ -406,7 +406,7 @@ class MockWorkerClient : public MockCoreWorkerClientInterface {
406406
return return_id;
407407
}
408408

409-
ReferenceCounter::ReferenceTableProto FinishExecutingTask(
409+
ReferenceCounterInterface::ReferenceTableProto FinishExecutingTask(
410410
const ObjectID &arg_id,
411411
const ObjectID &return_id,
412412
const ObjectID *return_wrapped_id = nullptr,
@@ -415,7 +415,7 @@ class MockWorkerClient : public MockCoreWorkerClientInterface {
415415
rc_.AddNestedObjectIds(return_id, {*return_wrapped_id}, *owner_address);
416416
}
417417

418-
ReferenceCounter::ReferenceTableProto refs;
418+
ReferenceCounterInterface::ReferenceTableProto refs;
419419
if (!arg_id.IsNil()) {
420420
rc_.PopAndClearLocalBorrowers({arg_id}, &refs, nullptr);
421421
}
@@ -427,7 +427,7 @@ class MockWorkerClient : public MockCoreWorkerClientInterface {
427427
const ObjectID &arg_id,
428428
const absl::flat_hash_map<ObjectID, std::vector<ObjectID>> &nested_return_ids = {},
429429
const rpc::Address &borrower_address = empty_borrower,
430-
const ReferenceCounter::ReferenceTableProto &borrower_refs = empty_refs) {
430+
const ReferenceCounterInterface::ReferenceTableProto &borrower_refs = empty_refs) {
431431
std::vector<ObjectID> arguments;
432432
for (const auto &pair : nested_return_ids) {
433433
// NOTE(swang): https://github.com/ray-project/ray/issues/17553.
@@ -2735,7 +2735,7 @@ TEST_F(ReferenceCountTest, TestGetObjectStatusReplyDelayed) {
27352735
ASSERT_TRUE(rc->HasReference(outer_id));
27362736
// Task finishes and our local ref to the outer ObjectRef is deleted. We
27372737
// return borrower information to the owner.
2738-
ReferenceCounter::ReferenceTableProto refs_proto;
2738+
ReferenceCounterInterface::ReferenceTableProto refs_proto;
27392739
rc->PopAndClearLocalBorrowers({outer_id}, &refs_proto, nullptr);
27402740
ASSERT_FALSE(rc->HasReference(outer_id));
27412741
// Future resolution is async, so we may receive information about the inner

0 commit comments

Comments
 (0)