mirror of
https://github.com/wassname/ray.git
synced 2026-06-30 20:18:33 +08:00
renaming project, halo -> ray (#95)
This commit is contained in:
committed by
Philipp Moritz
parent
44ae1788ee
commit
4cc024ae36
@@ -4,7 +4,7 @@ OperationId ComputationGraph::add_operation(std::unique_ptr<Operation> operation
|
||||
OperationId operationid = operations_.size();
|
||||
OperationId creator_operationid = operation->creator_operationid();
|
||||
if (spawned_operations_.size() != operationid) {
|
||||
HALO_LOG(HALO_FATAL, "ComputationGraph is attempting to call add_operation, but spawned_operations_.size() != operationid.");
|
||||
RAY_LOG(RAY_FATAL, "ComputationGraph is attempting to call add_operation, but spawned_operations_.size() != operationid.");
|
||||
}
|
||||
operations_.emplace_back(std::move(operation));
|
||||
if (creator_operationid != NO_OPERATION && creator_operationid != ROOT_OPERATION) {
|
||||
@@ -16,10 +16,10 @@ OperationId ComputationGraph::add_operation(std::unique_ptr<Operation> operation
|
||||
|
||||
const Task& ComputationGraph::get_task(OperationId operationid) {
|
||||
if (operationid >= operations_.size()) {
|
||||
HALO_LOG(HALO_FATAL, "ComputationGraph attempting to get_task with operationid " << operationid << ", but operationid >= operations_.size().");
|
||||
RAY_LOG(RAY_FATAL, "ComputationGraph attempting to get_task with operationid " << operationid << ", but operationid >= operations_.size().");
|
||||
}
|
||||
if (!operations_[operationid]->has_task()) {
|
||||
HALO_LOG(HALO_FATAL, "Calling get_task with operationid " << operationid << ", but this corresponds to a push not a task.");
|
||||
RAY_LOG(RAY_FATAL, "Calling get_task with operationid " << operationid << ", but this corresponds to a push not a task.");
|
||||
}
|
||||
return operations_[operationid]->task();
|
||||
}
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
#ifndef HALO_COMPUTATIONGRAPH_H
|
||||
#define HALO_COMPUTATIONGRAPH_H
|
||||
#ifndef RAY_COMPUTATIONGRAPH_H
|
||||
#define RAY_COMPUTATIONGRAPH_H
|
||||
|
||||
#include <iostream>
|
||||
#include <limits>
|
||||
|
||||
#include "halo/halo.h"
|
||||
#include "halo.grpc.pb.h"
|
||||
#include "ray/ray.h"
|
||||
#include "ray.grpc.pb.h"
|
||||
#include "types.pb.h"
|
||||
|
||||
// used to represent the root operation (that is, the driver code)
|
||||
|
||||
+6
-6
@@ -31,9 +31,9 @@ MemorySegmentPool::MemorySegmentPool(ObjStoreId objstoreid, bool create) : objst
|
||||
// creates a memory segment if it is not already there; if the pool is in create mode,
|
||||
// space is allocated, if it is in open mode, the shared memory is mapped into the process
|
||||
void MemorySegmentPool::open_segment(SegmentId segmentid, size_t size) {
|
||||
HALO_LOG(HALO_DEBUG, "Opening segmentid " << segmentid << " on object store " << objstoreid_ << " with create_mode_ = " << create_mode_);
|
||||
RAY_LOG(RAY_DEBUG, "Opening segmentid " << segmentid << " on object store " << objstoreid_ << " with create_mode_ = " << create_mode_);
|
||||
if (segmentid != segments_.size() && create_mode_) {
|
||||
HALO_LOG(HALO_FATAL, "Object store " << objstoreid_ << " is attempting to open segmentid " << segmentid << " on the object store, but segments_.size() = " << segments_.size());
|
||||
RAY_LOG(RAY_FATAL, "Object store " << objstoreid_ << " is attempting to open segmentid " << segmentid << " on the object store, but segments_.size() = " << segments_.size());
|
||||
}
|
||||
if (segmentid >= segments_.size()) { // resize and initialize segments_
|
||||
int current_size = segments_.size();
|
||||
@@ -47,7 +47,7 @@ void MemorySegmentPool::open_segment(SegmentId segmentid, size_t size) {
|
||||
return;
|
||||
}
|
||||
if (segments_[segmentid].second == SegmentStatusType::CLOSED) {
|
||||
HALO_LOG(HALO_FATAL, "Attempting to open segmentid " << segmentid << ", but segments_[segmentid].second == SegmentStatusType::CLOSED.");
|
||||
RAY_LOG(RAY_FATAL, "Attempting to open segmentid " << segmentid << ", but segments_[segmentid].second == SegmentStatusType::CLOSED.");
|
||||
}
|
||||
std::string segment_name = get_segment_name(segmentid);
|
||||
if (create_mode_) {
|
||||
@@ -61,7 +61,7 @@ void MemorySegmentPool::open_segment(SegmentId segmentid, size_t size) {
|
||||
}
|
||||
|
||||
void MemorySegmentPool::close_segment(SegmentId segmentid) {
|
||||
HALO_LOG(HALO_DEBUG, "closing segmentid " << segmentid);
|
||||
RAY_LOG(RAY_DEBUG, "closing segmentid " << segmentid);
|
||||
std::string segment_name = get_segment_name(segmentid);
|
||||
shared_memory_object::remove(segment_name.c_str());
|
||||
segments_[segmentid].first.reset();
|
||||
@@ -70,7 +70,7 @@ void MemorySegmentPool::close_segment(SegmentId segmentid) {
|
||||
|
||||
ObjHandle MemorySegmentPool::allocate(size_t size) {
|
||||
if (!create_mode_) { // allocate is called only by the object store
|
||||
HALO_LOG(HALO_FATAL, "Attempting to call allocate, but create_mode_ is false");
|
||||
RAY_LOG(RAY_FATAL, "Attempting to call allocate, but create_mode_ is false");
|
||||
}
|
||||
// TODO(pcm): at the moment, this always creates a new segment, this will be changed
|
||||
SegmentId segmentid = segments_.size();
|
||||
@@ -91,7 +91,7 @@ void MemorySegmentPool::deallocate(ObjHandle pointer) {
|
||||
// the process that will use the address
|
||||
uint8_t* MemorySegmentPool::get_address(ObjHandle pointer) {
|
||||
if (create_mode_ && segments_[pointer.segmentid()].second != SegmentStatusType::OPENED) {
|
||||
HALO_LOG(HALO_FATAL, "Object store " << objstoreid_ << " is attempting to call get_address on segmentid " << pointer.segmentid() << ", which has not been opened yet.");
|
||||
RAY_LOG(RAY_FATAL, "Object store " << objstoreid_ << " is attempting to call get_address on segmentid " << pointer.segmentid() << ", which has not been opened yet.");
|
||||
}
|
||||
if (!create_mode_) {
|
||||
open_segment(pointer.segmentid());
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#ifndef HALO_IPC_H
|
||||
#define HALO_IPC_H
|
||||
#ifndef RAY_IPC_H
|
||||
#define RAY_IPC_H
|
||||
|
||||
#include <iostream>
|
||||
#include <limits>
|
||||
@@ -10,7 +10,7 @@
|
||||
#include <arrow/api.h>
|
||||
#include <arrow/ipc/memory.h>
|
||||
|
||||
#include "halo/halo.h"
|
||||
#include "ray/ray.h"
|
||||
|
||||
using namespace boost::interprocess;
|
||||
|
||||
@@ -42,7 +42,7 @@ public:
|
||||
queue_ = std::unique_ptr<message_queue>(new message_queue(open_only, name.c_str()));
|
||||
}
|
||||
} catch(interprocess_exception &ex) {
|
||||
HALO_LOG(HALO_FATAL, "boost::interprocess exception: " << ex.what());
|
||||
RAY_LOG(RAY_FATAL, "boost::interprocess exception: " << ex.what());
|
||||
}
|
||||
return true;
|
||||
};
|
||||
@@ -55,7 +55,7 @@ public:
|
||||
try {
|
||||
queue_->send(object, sizeof(T), 0);
|
||||
} catch(interprocess_exception &ex) {
|
||||
HALO_LOG(HALO_FATAL, "boost::interprocess exception: " << ex.what());
|
||||
RAY_LOG(RAY_FATAL, "boost::interprocess exception: " << ex.what());
|
||||
}
|
||||
return true;
|
||||
};
|
||||
@@ -66,7 +66,7 @@ public:
|
||||
try {
|
||||
queue_->receive(object, sizeof(T), recvd_size, priority);
|
||||
} catch(interprocess_exception &ex) {
|
||||
HALO_LOG(HALO_FATAL, "boost::interprocess exception: " << ex.what());
|
||||
RAY_LOG(RAY_FATAL, "boost::interprocess exception: " << ex.what());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
+32
-32
@@ -8,7 +8,7 @@ const size_t ObjStoreService::CHUNK_SIZE = 8 * 1024;
|
||||
// this method needs to be protected by a objstore_lock_
|
||||
// TODO(rkn): Make sure that we do not in fact need the objstore_lock_. We want multiple deliveries to be able to happen simultaneously.
|
||||
void ObjStoreService::pull_data_from(ObjRef objref, ObjStore::Stub& stub) {
|
||||
HALO_LOG(HALO_DEBUG, "Objstore " << objstoreid_ << " is beginning to pull objref " << objref);
|
||||
RAY_LOG(RAY_DEBUG, "Objstore " << objstoreid_ << " is beginning to pull objref " << objref);
|
||||
ObjChunk chunk;
|
||||
ClientContext context;
|
||||
StreamObjToRequest stream_request;
|
||||
@@ -27,7 +27,7 @@ void ObjStoreService::pull_data_from(ObjRef objref, ObjStore::Stub& stub) {
|
||||
segmentpool_lock_.unlock();
|
||||
do {
|
||||
if (num_bytes + chunk.data().size() > total_size) {
|
||||
HALO_LOG(HALO_FATAL, "The reader attempted to stream too many bytes.");
|
||||
RAY_LOG(RAY_FATAL, "The reader attempted to stream too many bytes.");
|
||||
}
|
||||
std::memcpy(data, chunk.data().c_str(), chunk.data().size());
|
||||
data += chunk.data().size();
|
||||
@@ -37,10 +37,10 @@ void ObjStoreService::pull_data_from(ObjRef objref, ObjStore::Stub& stub) {
|
||||
|
||||
// finalize object
|
||||
if (num_bytes != total_size) {
|
||||
HALO_LOG(HALO_FATAL, "Streamed objref " << objref << ", but num_bytes != total_size");
|
||||
RAY_LOG(RAY_FATAL, "Streamed objref " << objref << ", but num_bytes != total_size");
|
||||
}
|
||||
object_ready(objref, chunk.metadata_offset());
|
||||
HALO_LOG(HALO_DEBUG, "finished streaming data, objref was " << objref << " and size was " << num_bytes);
|
||||
RAY_LOG(RAY_DEBUG, "finished streaming data, objref was " << objref << " and size was " << num_bytes);
|
||||
}
|
||||
|
||||
ObjStoreService::ObjStoreService(const std::string& objstore_address, std::shared_ptr<Channel> scheduler_channel)
|
||||
@@ -79,10 +79,10 @@ Status ObjStoreService::StartDelivery(ServerContext* context, const StartDeliver
|
||||
if (memory_[objref].second == MemoryStatusType::NOT_PRESENT) {
|
||||
}
|
||||
else if (memory_[objref].second == MemoryStatusType::DEALLOCATED) {
|
||||
HALO_LOG(HALO_FATAL, "Objstore " << objstoreid_ << " is attempting to get objref " << objref << ", but memory_[objref] == DEALLOCATED.");
|
||||
RAY_LOG(RAY_FATAL, "Objstore " << objstoreid_ << " is attempting to get objref " << objref << ", but memory_[objref] == DEALLOCATED.");
|
||||
}
|
||||
else {
|
||||
HALO_LOG(HALO_DEBUG, "Objstore " << objstoreid_ << " already has objref " << objref << " or it is already being shipped, so no need to pull it again.");
|
||||
RAY_LOG(RAY_DEBUG, "Objstore " << objstoreid_ << " already has objref " << objref << " or it is already being shipped, so no need to pull it again.");
|
||||
return Status::OK;
|
||||
}
|
||||
memory_[objref].second = MemoryStatusType::PRE_ALLOCED;
|
||||
@@ -115,15 +115,15 @@ Status ObjStoreService::ObjStoreInfo(ServerContext* context, const ObjStoreInfoR
|
||||
}
|
||||
|
||||
Status ObjStoreService::StreamObjTo(ServerContext* context, const StreamObjToRequest* request, ServerWriter<ObjChunk>* writer) {
|
||||
HALO_LOG(HALO_DEBUG, "begin to stream data from object store " << objstoreid_);
|
||||
RAY_LOG(RAY_DEBUG, "begin to stream data from object store " << objstoreid_);
|
||||
ObjChunk chunk;
|
||||
ObjRef objref = request->objref();
|
||||
memory_lock_.lock();
|
||||
if (objref >= memory_.size()) {
|
||||
HALO_LOG(HALO_FATAL, "Objstore " << objstoreid_ << " is attempting to use objref " << objref << " in StreamObjTo, but this objref is not present in the object store.");
|
||||
RAY_LOG(RAY_FATAL, "Objstore " << objstoreid_ << " is attempting to use objref " << objref << " in StreamObjTo, but this objref is not present in the object store.");
|
||||
}
|
||||
if (memory_[objref].second != MemoryStatusType::READY) {
|
||||
HALO_LOG(HALO_FATAL, "Objstore " << objstoreid_ << " is attempting to stream objref " << objref << ", but memory_[objref].second != MemoryStatusType::READY.");
|
||||
RAY_LOG(RAY_FATAL, "Objstore " << objstoreid_ << " is attempting to stream objref " << objref << ", but memory_[objref].second != MemoryStatusType::READY.");
|
||||
}
|
||||
ObjHandle handle = memory_[objref].first;
|
||||
memory_lock_.unlock(); // TODO(rkn): Make sure we don't still need to hold on to this lock.
|
||||
@@ -136,7 +136,7 @@ Status ObjStoreService::StreamObjTo(ServerContext* context, const StreamObjToReq
|
||||
chunk.set_total_size(size);
|
||||
chunk.set_data(head + i, std::min(CHUNK_SIZE, size - i));
|
||||
if (!writer->Write(chunk)) {
|
||||
HALO_LOG(HALO_FATAL, "stream connection prematurely closed")
|
||||
RAY_LOG(RAY_FATAL, "stream connection prematurely closed")
|
||||
}
|
||||
}
|
||||
return Status::OK;
|
||||
@@ -146,20 +146,20 @@ Status ObjStoreService::NotifyAlias(ServerContext* context, const NotifyAliasReq
|
||||
// NotifyAlias assumes that the objstore already holds canonical_objref
|
||||
ObjRef alias_objref = request->alias_objref();
|
||||
ObjRef canonical_objref = request->canonical_objref();
|
||||
HALO_LOG(HALO_DEBUG, "Aliasing objref " << alias_objref << " with objref " << canonical_objref);
|
||||
RAY_LOG(RAY_DEBUG, "Aliasing objref " << alias_objref << " with objref " << canonical_objref);
|
||||
{
|
||||
std::lock_guard<std::mutex> memory_lock(memory_lock_);
|
||||
if (canonical_objref >= memory_.size()) {
|
||||
HALO_LOG(HALO_FATAL, "Attempting to alias objref " << alias_objref << " with objref " << canonical_objref << ", but objref " << canonical_objref << " is not in the objstore.")
|
||||
RAY_LOG(RAY_FATAL, "Attempting to alias objref " << alias_objref << " with objref " << canonical_objref << ", but objref " << canonical_objref << " is not in the objstore.")
|
||||
}
|
||||
if (memory_[canonical_objref].second == MemoryStatusType::NOT_READY) {
|
||||
HALO_LOG(HALO_FATAL, "Attempting to alias objref " << alias_objref << " with objref " << canonical_objref << ", but objref " << canonical_objref << " is not ready yet in the objstore.")
|
||||
RAY_LOG(RAY_FATAL, "Attempting to alias objref " << alias_objref << " with objref " << canonical_objref << ", but objref " << canonical_objref << " is not ready yet in the objstore.")
|
||||
}
|
||||
if (memory_[canonical_objref].second == MemoryStatusType::NOT_PRESENT) {
|
||||
HALO_LOG(HALO_FATAL, "Attempting to alias objref " << alias_objref << " with objref " << canonical_objref << ", but objref " << canonical_objref << " is not present in the objstore.")
|
||||
RAY_LOG(RAY_FATAL, "Attempting to alias objref " << alias_objref << " with objref " << canonical_objref << ", but objref " << canonical_objref << " is not present in the objstore.")
|
||||
}
|
||||
if (memory_[canonical_objref].second == MemoryStatusType::DEALLOCATED) {
|
||||
HALO_LOG(HALO_FATAL, "Attempting to alias objref " << alias_objref << " with objref " << canonical_objref << ", but objref " << canonical_objref << " has already been deallocated.")
|
||||
RAY_LOG(RAY_FATAL, "Attempting to alias objref " << alias_objref << " with objref " << canonical_objref << ", but objref " << canonical_objref << " has already been deallocated.")
|
||||
}
|
||||
if (alias_objref >= memory_.size()) {
|
||||
memory_.resize(alias_objref + 1, std::make_pair(ObjHandle(), MemoryStatusType::NOT_PRESENT));
|
||||
@@ -176,13 +176,13 @@ Status ObjStoreService::NotifyAlias(ServerContext* context, const NotifyAliasReq
|
||||
|
||||
Status ObjStoreService::DeallocateObject(ServerContext* context, const DeallocateObjectRequest* request, AckReply* reply) {
|
||||
ObjRef canonical_objref = request->canonical_objref();
|
||||
HALO_LOG(HALO_REFCOUNT, "Deallocating canonical_objref " << canonical_objref);
|
||||
RAY_LOG(RAY_REFCOUNT, "Deallocating canonical_objref " << canonical_objref);
|
||||
std::lock_guard<std::mutex> memory_lock(memory_lock_);
|
||||
if (memory_[canonical_objref].second != MemoryStatusType::READY) {
|
||||
HALO_LOG(HALO_FATAL, "Attempting to deallocate canonical_objref " << canonical_objref << ", but memory_[canonical_objref].second = " << memory_[canonical_objref].second);
|
||||
RAY_LOG(RAY_FATAL, "Attempting to deallocate canonical_objref " << canonical_objref << ", but memory_[canonical_objref].second = " << memory_[canonical_objref].second);
|
||||
}
|
||||
if (canonical_objref >= memory_.size()) {
|
||||
HALO_LOG(HALO_FATAL, "Attempting to deallocate canonical_objref " << canonical_objref << ", but it is not in the objstore.");
|
||||
RAY_LOG(RAY_FATAL, "Attempting to deallocate canonical_objref " << canonical_objref << ", but it is not in the objstore.");
|
||||
}
|
||||
segmentpool_lock_.lock();
|
||||
segmentpool_->deallocate(memory_[canonical_objref].first);
|
||||
@@ -208,7 +208,7 @@ void ObjStoreService::process_objstore_request(const ObjRequest request) {
|
||||
}
|
||||
break;
|
||||
default: {
|
||||
HALO_LOG(HALO_FATAL, "Attempting to process request of type " << request.type << ". This code should be unreachable.");
|
||||
RAY_LOG(RAY_FATAL, "Attempting to process request of type " << request.type << ". This code should be unreachable.");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -237,13 +237,13 @@ void ObjStoreService::process_worker_request(const ObjRequest request) {
|
||||
std::lock_guard<std::mutex> memory_lock(memory_lock_);
|
||||
std::pair<ObjHandle, MemoryStatusType>& item = memory_[request.objref];
|
||||
if (item.second == MemoryStatusType::READY) {
|
||||
HALO_LOG(HALO_DEBUG, "Responding to GET request: returning objref " << request.objref);
|
||||
RAY_LOG(RAY_DEBUG, "Responding to GET request: returning objref " << request.objref);
|
||||
send_queues_[request.workerid].send(&item.first);
|
||||
} else if (item.second == MemoryStatusType::NOT_READY || item.second == MemoryStatusType::NOT_PRESENT || item.second == MemoryStatusType::PRE_ALLOCED) {
|
||||
std::lock_guard<std::mutex> lock(pull_queue_lock_);
|
||||
pull_queue_.push_back(std::make_pair(request.workerid, request.objref));
|
||||
} else {
|
||||
HALO_LOG(HALO_FATAL, "A worker requested objref " << request.objref << ", but memory_[objref].second = " << memory_[request.objref].second);
|
||||
RAY_LOG(RAY_FATAL, "A worker requested objref " << request.objref << ", but memory_[objref].second = " << memory_[request.objref].second);
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -252,7 +252,7 @@ void ObjStoreService::process_worker_request(const ObjRequest request) {
|
||||
}
|
||||
break;
|
||||
default: {
|
||||
HALO_LOG(HALO_FATAL, "Attempting to process request of type " << request.type << ". This code should be unreachable.");
|
||||
RAY_LOG(RAY_FATAL, "Attempting to process request of type " << request.type << ". This code should be unreachable.");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -264,17 +264,17 @@ void ObjStoreService::process_requests() {
|
||||
recv_queue_.receive(&request);
|
||||
switch (request.type) {
|
||||
case ObjRequestType::ALLOC: {
|
||||
HALO_LOG(HALO_VERBOSE, "Request (worker " << request.workerid << " to objstore " << objstoreid_ << "): Allocate object with objref " << request.objref << " and size " << request.size);
|
||||
RAY_LOG(RAY_VERBOSE, "Request (worker " << request.workerid << " to objstore " << objstoreid_ << "): Allocate object with objref " << request.objref << " and size " << request.size);
|
||||
process_worker_request(request);
|
||||
}
|
||||
break;
|
||||
case ObjRequestType::GET: {
|
||||
HALO_LOG(HALO_VERBOSE, "Request (worker " << request.workerid << " to objstore " << objstoreid_ << "): Get object with objref " << request.objref);
|
||||
RAY_LOG(RAY_VERBOSE, "Request (worker " << request.workerid << " to objstore " << objstoreid_ << "): Get object with objref " << request.objref);
|
||||
process_worker_request(request);
|
||||
}
|
||||
break;
|
||||
case ObjRequestType::WORKER_DONE: {
|
||||
HALO_LOG(HALO_VERBOSE, "Request (worker " << request.workerid << " to objstore " << objstoreid_ << "): Finalize object with objref " << request.objref);
|
||||
RAY_LOG(RAY_VERBOSE, "Request (worker " << request.workerid << " to objstore " << objstoreid_ << "): Finalize object with objref " << request.objref);
|
||||
process_worker_request(request);
|
||||
}
|
||||
break;
|
||||
@@ -283,7 +283,7 @@ void ObjStoreService::process_requests() {
|
||||
}
|
||||
break;
|
||||
default: {
|
||||
HALO_LOG(HALO_FATAL, "Attempting to process request of type " << request.type << ". This code should be unreachable.");
|
||||
RAY_LOG(RAY_FATAL, "Attempting to process request of type " << request.type << ". This code should be unreachable.");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -309,9 +309,9 @@ ObjHandle ObjStoreService::alloc(ObjRef objref, size_t size) {
|
||||
ObjHandle handle = segmentpool_->allocate(size);
|
||||
segmentpool_lock_.unlock();
|
||||
std::lock_guard<std::mutex> memory_lock(memory_lock_);
|
||||
HALO_LOG(HALO_VERBOSE, "Allocating space for objref " << objref << " on object store " << objstoreid_);
|
||||
RAY_LOG(RAY_VERBOSE, "Allocating space for objref " << objref << " on object store " << objstoreid_);
|
||||
if (memory_[objref].second != MemoryStatusType::NOT_PRESENT && memory_[objref].second != MemoryStatusType::PRE_ALLOCED) {
|
||||
HALO_LOG(HALO_FATAL, "Attempting to allocate space for objref " << objref << ", but memory_[objref].second = " << memory_[objref].second);
|
||||
RAY_LOG(RAY_FATAL, "Attempting to allocate space for objref " << objref << ", but memory_[objref].second = " << memory_[objref].second);
|
||||
}
|
||||
memory_[objref].first = handle;
|
||||
memory_[objref].second = MemoryStatusType::NOT_READY;
|
||||
@@ -323,7 +323,7 @@ void ObjStoreService::object_ready(ObjRef objref, size_t metadata_offset) {
|
||||
std::lock_guard<std::mutex> memory_lock(memory_lock_);
|
||||
std::pair<ObjHandle, MemoryStatusType>& item = memory_[objref];
|
||||
if (item.second != MemoryStatusType::NOT_READY) {
|
||||
HALO_LOG(HALO_FATAL, "A worker notified the object store that objref " << objref << " has been written to the object store, but memory_[objref].second != NOT_READY.");
|
||||
RAY_LOG(RAY_FATAL, "A worker notified the object store that objref " << objref << " has been written to the object store, but memory_[objref].second != NOT_READY.");
|
||||
}
|
||||
item.first.set_metadata_offset(metadata_offset);
|
||||
item.second = MemoryStatusType::READY;
|
||||
@@ -341,14 +341,14 @@ void ObjStoreService::object_ready(ObjRef objref, size_t metadata_offset) {
|
||||
|
||||
void ObjStoreService::start_objstore_service() {
|
||||
communicator_thread_ = std::thread([this]() {
|
||||
HALO_LOG(HALO_INFO, "started object store communicator server");
|
||||
RAY_LOG(RAY_INFO, "started object store communicator server");
|
||||
process_requests();
|
||||
});
|
||||
}
|
||||
|
||||
void start_objstore(const char* scheduler_addr, const char* objstore_addr) {
|
||||
auto scheduler_channel = grpc::CreateChannel(scheduler_addr, grpc::InsecureChannelCredentials());
|
||||
HALO_LOG(HALO_INFO, "object store " << objstore_addr << " connected to scheduler " << scheduler_addr);
|
||||
RAY_LOG(RAY_INFO, "object store " << objstore_addr << " connected to scheduler " << scheduler_addr);
|
||||
std::string objstore_address(objstore_addr);
|
||||
ObjStoreService service(objstore_address, scheduler_channel);
|
||||
service.start_objstore_service();
|
||||
@@ -365,7 +365,7 @@ void start_objstore(const char* scheduler_addr, const char* objstore_addr) {
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
if (argc != 3) {
|
||||
HALO_LOG(HALO_FATAL, "object store: expected two arguments (scheduler ip address and object store ip address)");
|
||||
RAY_LOG(RAY_FATAL, "object store: expected two arguments (scheduler ip address and object store ip address)");
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
+4
-4
@@ -1,5 +1,5 @@
|
||||
#ifndef HALO_OBJSTORE_H
|
||||
#define HALO_OBJSTORE_H
|
||||
#ifndef RAY_OBJSTORE_H
|
||||
#define RAY_OBJSTORE_H
|
||||
|
||||
#include <unordered_map>
|
||||
#include <memory>
|
||||
@@ -7,8 +7,8 @@
|
||||
#include <iostream>
|
||||
#include <grpc++/grpc++.h>
|
||||
|
||||
#include "halo/halo.h"
|
||||
#include "halo.grpc.pb.h"
|
||||
#include "ray/ray.h"
|
||||
#include "ray.grpc.pb.h"
|
||||
#include "types.pb.h"
|
||||
#include "ipc.h"
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@ static int PyObjRef_init(PyObjRef *self, PyObject *args, PyObject *kwds) {
|
||||
}
|
||||
std::vector<ObjRef> objrefs;
|
||||
objrefs.push_back(self->val);
|
||||
HALO_LOG(HALO_REFCOUNT, "In PyObjRef_init, calling increment_reference_count for objref " << objrefs[0]);
|
||||
RAY_LOG(RAY_REFCOUNT, "In PyObjRef_init, calling increment_reference_count for objref " << objrefs[0]);
|
||||
self->worker->increment_reference_count(objrefs);
|
||||
return 0;
|
||||
};
|
||||
@@ -70,7 +70,7 @@ static PyMemberDef PyObjRef_members[] = {
|
||||
static PyTypeObject PyObjRefType = {
|
||||
PyObject_HEAD_INIT(NULL)
|
||||
0, /* ob_size */
|
||||
"halo.ObjRef", /* tp_name */
|
||||
"ray.ObjRef", /* tp_name */
|
||||
sizeof(PyObjRef), /* tp_basicsize */
|
||||
0, /* tp_itemsize */
|
||||
(destructor)PyObjRef_dealloc, /* tp_dealloc */
|
||||
@@ -89,7 +89,7 @@ static PyTypeObject PyObjRefType = {
|
||||
0, /* tp_setattro */
|
||||
0, /* tp_as_buffer */
|
||||
Py_TPFLAGS_DEFAULT, /* tp_flags */
|
||||
"Halo objects", /* tp_doc */
|
||||
"Ray objects", /* tp_doc */
|
||||
0, /* tp_traverse */
|
||||
0, /* tp_clear */
|
||||
0, /* tp_richcompare */
|
||||
@@ -119,7 +119,7 @@ PyObject* make_pyobjref(PyObject* worker_capsule, ObjRef objref) {
|
||||
|
||||
// Error handling
|
||||
|
||||
static PyObject *HaloError;
|
||||
static PyObject *RayError;
|
||||
|
||||
// Pass arguments from Python to C++
|
||||
|
||||
@@ -312,12 +312,12 @@ int serialize(PyObject* worker_capsule, PyObject* val, Obj* obj, std::vector<Obj
|
||||
}
|
||||
break;
|
||||
default:
|
||||
PyErr_SetString(HaloError, "serialization: numpy datatype not know");
|
||||
PyErr_SetString(RayError, "serialization: numpy datatype not know");
|
||||
return -1;
|
||||
}
|
||||
Py_DECREF(array); // TODO(rkn): is this right?
|
||||
} else {
|
||||
PyErr_SetString(HaloError, "serialization: type not know");
|
||||
PyErr_SetString(RayError, "serialization: type not know");
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
@@ -402,7 +402,7 @@ PyObject* deserialize(PyObject* worker_capsule, const Obj& obj, std::vector<ObjR
|
||||
}
|
||||
break;
|
||||
default:
|
||||
PyErr_SetString(HaloError, "deserialization: internal error (array type not implemented)");
|
||||
PyErr_SetString(RayError, "deserialization: internal error (array type not implemented)");
|
||||
return NULL;
|
||||
}
|
||||
} else if (array.uint_data_size() > 0) {
|
||||
@@ -423,7 +423,7 @@ PyObject* deserialize(PyObject* worker_capsule, const Obj& obj, std::vector<ObjR
|
||||
}
|
||||
break;
|
||||
default:
|
||||
PyErr_SetString(HaloError, "deserialization: internal error (array type not implemented)");
|
||||
PyErr_SetString(RayError, "deserialization: internal error (array type not implemented)");
|
||||
return NULL;
|
||||
}
|
||||
} else if (array.objref_data_size() > 0) {
|
||||
@@ -434,12 +434,12 @@ PyObject* deserialize(PyObject* worker_capsule, const Obj& obj, std::vector<ObjR
|
||||
objrefs.push_back(array.objref_data(i));
|
||||
}
|
||||
} else {
|
||||
PyErr_SetString(HaloError, "deserialization: internal error (array type not implemented)");
|
||||
PyErr_SetString(RayError, "deserialization: internal error (array type not implemented)");
|
||||
return NULL;
|
||||
}
|
||||
return (PyObject*) pyarray;
|
||||
} else {
|
||||
PyErr_SetString(HaloError, "deserialization: internal error (type not implemented)");
|
||||
PyErr_SetString(RayError, "deserialization: internal error (type not implemented)");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
@@ -535,13 +535,13 @@ PyObject* serialize_task(PyObject* self, PyObject* args) {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
PyErr_SetString(HaloError, "serialize_task: second argument needs to be a list");
|
||||
PyErr_SetString(RayError, "serialize_task: second argument needs to be a list");
|
||||
return NULL;
|
||||
}
|
||||
Worker* worker;
|
||||
PyObjectToWorker(worker_capsule, &worker);
|
||||
if (objrefs.size() > 0) {
|
||||
HALO_LOG(HALO_REFCOUNT, "In serialize_task, calling increment_reference_count for contained objrefs");
|
||||
RAY_LOG(RAY_REFCOUNT, "In serialize_task, calling increment_reference_count for contained objrefs");
|
||||
worker->increment_reference_count(objrefs);
|
||||
}
|
||||
return PyCapsule_New(static_cast<void*>(task), "task", &TaskCapsule_Destructor);
|
||||
@@ -584,7 +584,7 @@ PyObject* deserialize_task(PyObject* self, PyObject* args) {
|
||||
return t;
|
||||
}
|
||||
|
||||
// Halo Python API
|
||||
// Ray Python API
|
||||
|
||||
PyObject* create_worker(PyObject* self, PyObject* args) {
|
||||
const char* scheduler_addr;
|
||||
@@ -692,7 +692,7 @@ PyObject* put_object(PyObject* self, PyObject* args) {
|
||||
return NULL;
|
||||
}
|
||||
if (!PyList_Check(contained_objrefs)) {
|
||||
HALO_LOG(HALO_FATAL, "The contained_objrefs argument must be a list.")
|
||||
RAY_LOG(RAY_FATAL, "The contained_objrefs argument must be a list.")
|
||||
}
|
||||
std::vector<ObjRef> vec_contained_objrefs;
|
||||
size_t size = PyList_Size(contained_objrefs);
|
||||
@@ -773,7 +773,7 @@ PyObject* scheduler_info(PyObject* self, PyObject* args) {
|
||||
return dict;
|
||||
}
|
||||
|
||||
static PyMethodDef HaloLibMethods[] = {
|
||||
static PyMethodDef RayLibMethods[] = {
|
||||
{ "serialize_object", serialize_object, METH_VARARGS, "serialize an object to protocol buffers" },
|
||||
{ "deserialize_object", deserialize_object, METH_VARARGS, "deserialize an object from protocol buffers" },
|
||||
{ "put_arrow", put_arrow, METH_VARARGS, "put an arrow array on the local object store"},
|
||||
@@ -798,18 +798,18 @@ static PyMethodDef HaloLibMethods[] = {
|
||||
{ NULL, NULL, 0, NULL }
|
||||
};
|
||||
|
||||
PyMODINIT_FUNC initlibhalolib(void) {
|
||||
PyMODINIT_FUNC initlibraylib(void) {
|
||||
PyObject* m;
|
||||
PyObjRefType.tp_new = PyType_GenericNew;
|
||||
if (PyType_Ready(&PyObjRefType) < 0) {
|
||||
return;
|
||||
}
|
||||
m = Py_InitModule3("libhalolib", HaloLibMethods, "Python C Extension for Halo");
|
||||
m = Py_InitModule3("libraylib", RayLibMethods, "Python C Extension for Ray");
|
||||
Py_INCREF(&PyObjRefType);
|
||||
PyModule_AddObject(m, "ObjRef", (PyObject *)&PyObjRefType);
|
||||
HaloError = PyErr_NewException("halo.error", NULL, NULL);
|
||||
Py_INCREF(HaloError);
|
||||
PyModule_AddObject(m, "error", HaloError);
|
||||
RayError = PyErr_NewException("ray.error", NULL, NULL);
|
||||
Py_INCREF(RayError);
|
||||
PyModule_AddObject(m, "error", RayError);
|
||||
import_array();
|
||||
}
|
||||
|
||||
+51
-51
@@ -14,7 +14,7 @@ Status SchedulerService::SubmitTask(ServerContext* context, const SubmitTaskRequ
|
||||
|
||||
if (fntable_.find(task->name()) == fntable_.end()) {
|
||||
// TODO(rkn): In the future, this should probably not be fatal. Instead, propagate the error back to the worker.
|
||||
HALO_LOG(HALO_FATAL, "The function " << task->name() << " has not been registered by any worker.");
|
||||
RAY_LOG(RAY_FATAL, "The function " << task->name() << " has not been registered by any worker.");
|
||||
}
|
||||
|
||||
size_t num_return_vals = fntable_[task->name()].num_return_vals();
|
||||
@@ -29,8 +29,8 @@ Status SchedulerService::SubmitTask(ServerContext* context, const SubmitTaskRequ
|
||||
}
|
||||
{
|
||||
std::lock_guard<std::mutex> reference_counts_lock(reference_counts_lock_); // we grab this lock because increment_ref_count assumes it has been acquired
|
||||
increment_ref_count(result_objrefs); // We increment once so the objrefs don't go out of scope before we reply to the worker that called SubmitTask. The corresponding decrement will happen in submit_task in halolib.
|
||||
increment_ref_count(result_objrefs); // We increment once so the objrefs don't go out of scope before the task is scheduled on the worker. The corresponding decrement will happen in deserialize_task in halolib.
|
||||
increment_ref_count(result_objrefs); // We increment once so the objrefs don't go out of scope before we reply to the worker that called SubmitTask. The corresponding decrement will happen in submit_task in raylib.
|
||||
increment_ref_count(result_objrefs); // We increment once so the objrefs don't go out of scope before the task is scheduled on the worker. The corresponding decrement will happen in deserialize_task in raylib.
|
||||
}
|
||||
|
||||
auto operation = std::unique_ptr<Operation>(new Operation());
|
||||
@@ -64,7 +64,7 @@ Status SchedulerService::RequestObj(ServerContext* context, const RequestObjRequ
|
||||
|
||||
ObjRef objref = request->objref();
|
||||
if (objref >= size) {
|
||||
HALO_LOG(HALO_FATAL, "internal error: no object with objref " << objref << " exists");
|
||||
RAY_LOG(RAY_FATAL, "internal error: no object with objref " << objref << " exists");
|
||||
}
|
||||
|
||||
pull_queue_lock_.lock();
|
||||
@@ -77,23 +77,23 @@ Status SchedulerService::RequestObj(ServerContext* context, const RequestObjRequ
|
||||
Status SchedulerService::AliasObjRefs(ServerContext* context, const AliasObjRefsRequest* request, AckReply* reply) {
|
||||
ObjRef alias_objref = request->alias_objref();
|
||||
ObjRef target_objref = request->target_objref();
|
||||
HALO_LOG(HALO_ALIAS, "Aliasing objref " << alias_objref << " with objref " << target_objref);
|
||||
RAY_LOG(RAY_ALIAS, "Aliasing objref " << alias_objref << " with objref " << target_objref);
|
||||
if (alias_objref == target_objref) {
|
||||
HALO_LOG(HALO_FATAL, "internal error: attempting to alias objref " << alias_objref << " with itself.");
|
||||
RAY_LOG(RAY_FATAL, "internal error: attempting to alias objref " << alias_objref << " with itself.");
|
||||
}
|
||||
objtable_lock_.lock();
|
||||
size_t size = objtable_.size();
|
||||
objtable_lock_.unlock();
|
||||
if (alias_objref >= size) {
|
||||
HALO_LOG(HALO_FATAL, "internal error: no object with objref " << alias_objref << " exists");
|
||||
RAY_LOG(RAY_FATAL, "internal error: no object with objref " << alias_objref << " exists");
|
||||
}
|
||||
if (target_objref >= size) {
|
||||
HALO_LOG(HALO_FATAL, "internal error: no object with objref " << target_objref << " exists");
|
||||
RAY_LOG(RAY_FATAL, "internal error: no object with objref " << target_objref << " exists");
|
||||
}
|
||||
{
|
||||
std::lock_guard<std::mutex> target_objrefs_lock(target_objrefs_lock_);
|
||||
if (target_objrefs_[alias_objref] != UNITIALIZED_ALIAS) {
|
||||
HALO_LOG(HALO_FATAL, "internal error: attempting to alias objref " << alias_objref << " with objref " << target_objref << ", but objref " << alias_objref << " has already been aliased with objref " << target_objrefs_[alias_objref]);
|
||||
RAY_LOG(RAY_FATAL, "internal error: attempting to alias objref " << alias_objref << " with objref " << target_objref << ", but objref " << alias_objref << " has already been aliased with objref " << target_objrefs_[alias_objref]);
|
||||
}
|
||||
target_objrefs_[alias_objref] = target_objref;
|
||||
}
|
||||
@@ -121,7 +121,7 @@ Status SchedulerService::RegisterWorker(ServerContext* context, const RegisterWo
|
||||
std::pair<WorkerId, ObjStoreId> info = register_worker(request->worker_address(), request->objstore_address());
|
||||
WorkerId workerid = info.first;
|
||||
ObjStoreId objstoreid = info.second;
|
||||
HALO_LOG(HALO_INFO, "registered worker with workerid " << workerid);
|
||||
RAY_LOG(RAY_INFO, "registered worker with workerid " << workerid);
|
||||
reply->set_workerid(workerid);
|
||||
reply->set_objstoreid(objstoreid);
|
||||
schedule();
|
||||
@@ -129,7 +129,7 @@ Status SchedulerService::RegisterWorker(ServerContext* context, const RegisterWo
|
||||
}
|
||||
|
||||
Status SchedulerService::RegisterFunction(ServerContext* context, const RegisterFunctionRequest* request, AckReply* reply) {
|
||||
HALO_LOG(HALO_INFO, "register function " << request->fnname() << " from workerid " << request->workerid());
|
||||
RAY_LOG(RAY_INFO, "register function " << request->fnname() << " from workerid " << request->workerid());
|
||||
register_function(request->fnname(), request->workerid(), request->num_return_vals());
|
||||
schedule();
|
||||
return Status::OK;
|
||||
@@ -137,7 +137,7 @@ Status SchedulerService::RegisterFunction(ServerContext* context, const Register
|
||||
|
||||
Status SchedulerService::ObjReady(ServerContext* context, const ObjReadyRequest* request, AckReply* reply) {
|
||||
ObjRef objref = request->objref();
|
||||
HALO_LOG(HALO_DEBUG, "object " << objref << " ready on store " << request->objstoreid());
|
||||
RAY_LOG(RAY_DEBUG, "object " << objref << " ready on store " << request->objstoreid());
|
||||
add_canonical_objref(objref);
|
||||
add_location(objref, request->objstoreid());
|
||||
schedule();
|
||||
@@ -145,7 +145,7 @@ Status SchedulerService::ObjReady(ServerContext* context, const ObjReadyRequest*
|
||||
}
|
||||
|
||||
Status SchedulerService::WorkerReady(ServerContext* context, const WorkerReadyRequest* request, AckReply* reply) {
|
||||
HALO_LOG(HALO_INFO, "worker " << request->workerid() << " reported back");
|
||||
RAY_LOG(RAY_INFO, "worker " << request->workerid() << " reported back");
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(avail_workers_lock_);
|
||||
avail_workers_.push_back(request->workerid());
|
||||
@@ -157,7 +157,7 @@ Status SchedulerService::WorkerReady(ServerContext* context, const WorkerReadyRe
|
||||
Status SchedulerService::IncrementRefCount(ServerContext* context, const IncrementRefCountRequest* request, AckReply* reply) {
|
||||
int num_objrefs = request->objref_size();
|
||||
if (num_objrefs == 0) {
|
||||
HALO_LOG(HALO_FATAL, "Scheduler received IncrementRefCountRequest with 0 objrefs.");
|
||||
RAY_LOG(RAY_FATAL, "Scheduler received IncrementRefCountRequest with 0 objrefs.");
|
||||
}
|
||||
std::vector<ObjRef> objrefs;
|
||||
for (int i = 0; i < num_objrefs; ++i) {
|
||||
@@ -171,7 +171,7 @@ Status SchedulerService::IncrementRefCount(ServerContext* context, const Increme
|
||||
Status SchedulerService::DecrementRefCount(ServerContext* context, const DecrementRefCountRequest* request, AckReply* reply) {
|
||||
int num_objrefs = request->objref_size();
|
||||
if (num_objrefs == 0) {
|
||||
HALO_LOG(HALO_FATAL, "Scheduler received DecrementRefCountRequest with 0 objrefs.");
|
||||
RAY_LOG(RAY_FATAL, "Scheduler received DecrementRefCountRequest with 0 objrefs.");
|
||||
}
|
||||
std::vector<ObjRef> objrefs;
|
||||
for (int i = 0; i < num_objrefs; ++i) {
|
||||
@@ -186,11 +186,11 @@ Status SchedulerService::AddContainedObjRefs(ServerContext* context, const AddCo
|
||||
ObjRef objref = request->objref();
|
||||
// if (!is_canonical(objref)) {
|
||||
// TODO(rkn): Perhaps we don't need this check. It won't work because the objstore may not have called ObjReady yet.
|
||||
// HALO_LOG(HALO_FATAL, "Attempting to add contained objrefs for non-canonical objref " << objref);
|
||||
// RAY_LOG(RAY_FATAL, "Attempting to add contained objrefs for non-canonical objref " << objref);
|
||||
// }
|
||||
std::lock_guard<std::mutex> contained_objrefs_lock(contained_objrefs_lock_);
|
||||
if (contained_objrefs_[objref].size() != 0) {
|
||||
HALO_LOG(HALO_FATAL, "Attempting to add contained objrefs for objref " << objref << ", but contained_objrefs_[objref].size() != 0.");
|
||||
RAY_LOG(RAY_FATAL, "Attempting to add contained objrefs for objref " << objref << ", but contained_objrefs_[objref].size() != 0.");
|
||||
}
|
||||
for (int i = 0; i < request->contained_objref_size(); ++i) {
|
||||
contained_objrefs_[objref].push_back(request->contained_objref(i));
|
||||
@@ -212,10 +212,10 @@ Status SchedulerService::SchedulerInfo(ServerContext* context, const SchedulerIn
|
||||
// deliver_object assumes that the aliasing for objref has already been completed. That is, has_canonical_objref(objref) == true
|
||||
void SchedulerService::deliver_object(ObjRef objref, ObjStoreId from, ObjStoreId to) {
|
||||
if (from == to) {
|
||||
HALO_LOG(HALO_FATAL, "attempting to deliver objref " << objref << " from objstore " << from << " to itself.");
|
||||
RAY_LOG(RAY_FATAL, "attempting to deliver objref " << objref << " from objstore " << from << " to itself.");
|
||||
}
|
||||
if (!has_canonical_objref(objref)) {
|
||||
HALO_LOG(HALO_FATAL, "attempting to deliver objref " << objref << ", but this objref does not yet have a canonical objref.");
|
||||
RAY_LOG(RAY_FATAL, "attempting to deliver objref " << objref << ", but this objref does not yet have a canonical objref.");
|
||||
}
|
||||
ClientContext context;
|
||||
AckReply reply;
|
||||
@@ -235,7 +235,7 @@ void SchedulerService::schedule() {
|
||||
} else if (scheduling_algorithm_ == SCHEDULING_ALGORITHM_LOCALITY_AWARE) {
|
||||
schedule_tasks_location_aware(); // See what we can do in task_queue_
|
||||
} else {
|
||||
HALO_LOG(HALO_FATAL, "scheduling algorithm not known");
|
||||
RAY_LOG(RAY_FATAL, "scheduling algorithm not known");
|
||||
}
|
||||
perform_notify_aliases(); // See what we can do in alias_notification_queue_
|
||||
}
|
||||
@@ -247,7 +247,7 @@ void SchedulerService::assign_task(OperationId operationid, WorkerId workerid) {
|
||||
ClientContext context;
|
||||
ExecuteTaskRequest request;
|
||||
ExecuteTaskReply reply;
|
||||
HALO_LOG(HALO_INFO, "starting to send arguments");
|
||||
RAY_LOG(RAY_INFO, "starting to send arguments");
|
||||
for (size_t i = 0; i < task.arg_size(); ++i) {
|
||||
if (!task.arg(i).has_obj()) {
|
||||
ObjRef objref = task.arg(i).ref();
|
||||
@@ -259,7 +259,7 @@ void SchedulerService::assign_task(OperationId operationid, WorkerId workerid) {
|
||||
}
|
||||
attempt_notify_alias(get_store(workerid), objref, canonical_objref);
|
||||
|
||||
HALO_LOG(HALO_DEBUG, "task contains object ref " << canonical_objref);
|
||||
RAY_LOG(RAY_DEBUG, "task contains object ref " << canonical_objref);
|
||||
std::lock_guard<std::mutex> objtable_lock(objtable_lock_);
|
||||
auto &objstores = objtable_[canonical_objref];
|
||||
std::lock_guard<std::mutex> workers_lock(workers_lock_);
|
||||
@@ -290,7 +290,7 @@ bool SchedulerService::can_run(const Task& task) {
|
||||
}
|
||||
|
||||
std::pair<WorkerId, ObjStoreId> SchedulerService::register_worker(const std::string& worker_address, const std::string& objstore_address) {
|
||||
HALO_LOG(HALO_INFO, "registering worker " << worker_address << " connected to object store " << objstore_address);
|
||||
RAY_LOG(RAY_INFO, "registering worker " << worker_address << " connected to object store " << objstore_address);
|
||||
ObjStoreId objstoreid = std::numeric_limits<size_t>::max();
|
||||
for (int num_attempts = 0; num_attempts < 5; ++num_attempts) {
|
||||
std::lock_guard<std::mutex> lock(objstores_lock_);
|
||||
@@ -304,7 +304,7 @@ std::pair<WorkerId, ObjStoreId> SchedulerService::register_worker(const std::str
|
||||
}
|
||||
}
|
||||
if (objstoreid == std::numeric_limits<size_t>::max()) {
|
||||
HALO_LOG(HALO_FATAL, "object store with address " << objstore_address << " not yet registered");
|
||||
RAY_LOG(RAY_FATAL, "object store with address " << objstore_address << " not yet registered");
|
||||
}
|
||||
workers_lock_.lock();
|
||||
WorkerId workerid = workers_.size();
|
||||
@@ -334,16 +334,16 @@ ObjRef SchedulerService::register_new_object() {
|
||||
ObjRef reference_counts_size = reference_counts_.size();
|
||||
ObjRef contained_objrefs_size = contained_objrefs_.size();
|
||||
if (objtable_size != target_objrefs_size) {
|
||||
HALO_LOG(HALO_FATAL, "objtable_ and target_objrefs_ should have the same size, but objtable_.size() = " << objtable_size << " and target_objrefs_.size() = " << target_objrefs_size);
|
||||
RAY_LOG(RAY_FATAL, "objtable_ and target_objrefs_ should have the same size, but objtable_.size() = " << objtable_size << " and target_objrefs_.size() = " << target_objrefs_size);
|
||||
}
|
||||
if (objtable_size != reverse_target_objrefs_size) {
|
||||
HALO_LOG(HALO_FATAL, "objtable_ and reverse_target_objrefs_ should have the same size, but objtable_.size() = " << objtable_size << " and reverse_target_objrefs_.size() = " << reverse_target_objrefs_size);
|
||||
RAY_LOG(RAY_FATAL, "objtable_ and reverse_target_objrefs_ should have the same size, but objtable_.size() = " << objtable_size << " and reverse_target_objrefs_.size() = " << reverse_target_objrefs_size);
|
||||
}
|
||||
if (objtable_size != reference_counts_size) {
|
||||
HALO_LOG(HALO_FATAL, "objtable_ and reference_counts_ should have the same size, but objtable_.size() = " << objtable_size << " and reference_counts_.size() = " << reference_counts_size);
|
||||
RAY_LOG(RAY_FATAL, "objtable_ and reference_counts_ should have the same size, but objtable_.size() = " << objtable_size << " and reference_counts_.size() = " << reference_counts_size);
|
||||
}
|
||||
if (objtable_size != contained_objrefs_size) {
|
||||
HALO_LOG(HALO_FATAL, "objtable_ and contained_objrefs_ should have the same size, but objtable_.size() = " << objtable_size << " and contained_objrefs_.size() = " << contained_objrefs_size);
|
||||
RAY_LOG(RAY_FATAL, "objtable_ and contained_objrefs_ should have the same size, but objtable_.size() = " << objtable_size << " and contained_objrefs_.size() = " << contained_objrefs_size);
|
||||
}
|
||||
objtable_.push_back(std::vector<ObjStoreId>());
|
||||
target_objrefs_.push_back(UNITIALIZED_ALIAS);
|
||||
@@ -356,11 +356,11 @@ ObjRef SchedulerService::register_new_object() {
|
||||
void SchedulerService::add_location(ObjRef canonical_objref, ObjStoreId objstoreid) {
|
||||
// add_location must be called with a canonical objref
|
||||
if (!is_canonical(canonical_objref)) {
|
||||
HALO_LOG(HALO_FATAL, "Attempting to call add_location with a non-canonical objref (objref " << canonical_objref << ")");
|
||||
RAY_LOG(RAY_FATAL, "Attempting to call add_location with a non-canonical objref (objref " << canonical_objref << ")");
|
||||
}
|
||||
std::lock_guard<std::mutex> objtable_lock(objtable_lock_);
|
||||
if (canonical_objref >= objtable_.size()) {
|
||||
HALO_LOG(HALO_FATAL, "trying to put an object in the object store that was not registered with the scheduler (objref " << canonical_objref << ")");
|
||||
RAY_LOG(RAY_FATAL, "trying to put an object in the object store that was not registered with the scheduler (objref " << canonical_objref << ")");
|
||||
}
|
||||
// do a binary search
|
||||
auto pos = std::lower_bound(objtable_[canonical_objref].begin(), objtable_[canonical_objref].end(), objstoreid);
|
||||
@@ -372,10 +372,10 @@ void SchedulerService::add_location(ObjRef canonical_objref, ObjStoreId objstore
|
||||
void SchedulerService::add_canonical_objref(ObjRef objref) {
|
||||
std::lock_guard<std::mutex> lock(target_objrefs_lock_);
|
||||
if (objref >= target_objrefs_.size()) {
|
||||
HALO_LOG(HALO_FATAL, "internal error: attempting to insert objref " << objref << " in target_objrefs_, but target_objrefs_.size() is " << target_objrefs_.size());
|
||||
RAY_LOG(RAY_FATAL, "internal error: attempting to insert objref " << objref << " in target_objrefs_, but target_objrefs_.size() is " << target_objrefs_.size());
|
||||
}
|
||||
if (target_objrefs_[objref] != UNITIALIZED_ALIAS && target_objrefs_[objref] != objref) {
|
||||
HALO_LOG(HALO_FATAL, "internal error: attempting to declare objref " << objref << " as a canonical objref, but target_objrefs_[objref] is already aliased with objref " << target_objrefs_[objref]);
|
||||
RAY_LOG(RAY_FATAL, "internal error: attempting to declare objref " << objref << " as a canonical objref, but target_objrefs_[objref] is already aliased with objref " << target_objrefs_[objref]);
|
||||
}
|
||||
target_objrefs_[objref] = objref;
|
||||
}
|
||||
@@ -433,7 +433,7 @@ void SchedulerService::get_info(const SchedulerInfoRequest& request, SchedulerIn
|
||||
ObjStoreId SchedulerService::pick_objstore(ObjRef canonical_objref) {
|
||||
std::mt19937 rng;
|
||||
if (!is_canonical(canonical_objref)) {
|
||||
HALO_LOG(HALO_FATAL, "Attempting to call pick_objstore with a non-canonical objref, (objref " << canonical_objref << ")");
|
||||
RAY_LOG(RAY_FATAL, "Attempting to call pick_objstore with a non-canonical objref, (objref " << canonical_objref << ")");
|
||||
}
|
||||
std::uniform_int_distribution<int> uni(0, objtable_[canonical_objref].size() - 1);
|
||||
ObjStoreId objstoreid = objtable_[canonical_objref][uni(rng)];
|
||||
@@ -443,7 +443,7 @@ ObjStoreId SchedulerService::pick_objstore(ObjRef canonical_objref) {
|
||||
bool SchedulerService::is_canonical(ObjRef objref) {
|
||||
std::lock_guard<std::mutex> lock(target_objrefs_lock_);
|
||||
if (target_objrefs_[objref] == UNITIALIZED_ALIAS) {
|
||||
HALO_LOG(HALO_FATAL, "Attempting to call is_canonical on an objref for which aliasing is not complete or the object is not ready, target_objrefs_[objref] == UNITIALIZED_ALIAS for objref " << objref << ".");
|
||||
RAY_LOG(RAY_FATAL, "Attempting to call is_canonical on an objref for which aliasing is not complete or the object is not ready, target_objrefs_[objref] == UNITIALIZED_ALIAS for objref " << objref << ".");
|
||||
}
|
||||
return objref == target_objrefs_[objref];
|
||||
}
|
||||
@@ -456,11 +456,11 @@ void SchedulerService::perform_pulls() {
|
||||
ObjRef objref = pull.second;
|
||||
WorkerId workerid = pull.first;
|
||||
if (!has_canonical_objref(objref)) {
|
||||
HALO_LOG(HALO_ALIAS, "objref " << objref << " does not have a canonical_objref, so continuing");
|
||||
RAY_LOG(RAY_ALIAS, "objref " << objref << " does not have a canonical_objref, so continuing");
|
||||
continue;
|
||||
}
|
||||
ObjRef canonical_objref = get_canonical_objref(objref);
|
||||
HALO_LOG(HALO_DEBUG, "attempting to pull objref " << pull.second << " with canonical objref " << canonical_objref << " to objstore " << get_store(workerid));
|
||||
RAY_LOG(RAY_DEBUG, "attempting to pull objref " << pull.second << " with canonical objref " << canonical_objref << " to objstore " << get_store(workerid));
|
||||
|
||||
objtable_lock_.lock();
|
||||
int num_stores = objtable_[canonical_objref].size();
|
||||
@@ -538,7 +538,7 @@ void SchedulerService::schedule_tasks_location_aware() {
|
||||
if (!task.arg(j).has_obj()) {
|
||||
ObjRef objref = task.arg(j).ref();
|
||||
if (!has_canonical_objref(objref)) {
|
||||
HALO_LOG(HALO_FATAL, "no canonical object ref found even though task is ready; that should not be possible!");
|
||||
RAY_LOG(RAY_FATAL, "no canonical object ref found even though task is ready; that should not be possible!");
|
||||
}
|
||||
ObjRef canonical_objref = get_canonical_objref(objref);
|
||||
// check if the object is already in the local object store
|
||||
@@ -585,7 +585,7 @@ bool SchedulerService::has_canonical_objref(ObjRef objref) {
|
||||
ObjRef objref_temp = objref;
|
||||
while (true) {
|
||||
if (objref_temp >= target_objrefs_.size()) {
|
||||
HALO_LOG(HALO_FATAL, "Attempting to index target_objrefs_ with objref " << objref_temp << ", but target_objrefs_.size() = " << target_objrefs_.size());
|
||||
RAY_LOG(RAY_FATAL, "Attempting to index target_objrefs_ with objref " << objref_temp << ", but target_objrefs_.size() = " << target_objrefs_.size());
|
||||
}
|
||||
if (target_objrefs_[objref_temp] == UNITIALIZED_ALIAS) {
|
||||
return false;
|
||||
@@ -603,16 +603,16 @@ ObjRef SchedulerService::get_canonical_objref(ObjRef objref) {
|
||||
ObjRef objref_temp = objref;
|
||||
while (true) {
|
||||
if (objref_temp >= target_objrefs_.size()) {
|
||||
HALO_LOG(HALO_FATAL, "Attempting to index target_objrefs_ with objref " << objref_temp << ", but target_objrefs_.size() = " << target_objrefs_.size());
|
||||
RAY_LOG(RAY_FATAL, "Attempting to index target_objrefs_ with objref " << objref_temp << ", but target_objrefs_.size() = " << target_objrefs_.size());
|
||||
}
|
||||
if (target_objrefs_[objref_temp] == UNITIALIZED_ALIAS) {
|
||||
HALO_LOG(HALO_FATAL, "Attempting to get canonical objref for objref " << objref << ", which aliases, objref " << objref_temp << ", but target_objrefs_[objref_temp] == UNITIALIZED_ALIAS for objref_temp = " << objref_temp << ".");
|
||||
RAY_LOG(RAY_FATAL, "Attempting to get canonical objref for objref " << objref << ", which aliases, objref " << objref_temp << ", but target_objrefs_[objref_temp] == UNITIALIZED_ALIAS for objref_temp = " << objref_temp << ".");
|
||||
}
|
||||
if (target_objrefs_[objref_temp] == objref_temp) {
|
||||
return objref_temp;
|
||||
}
|
||||
objref_temp = target_objrefs_[objref_temp];
|
||||
HALO_LOG(HALO_ALIAS, "Looping in get_canonical_objref.");
|
||||
RAY_LOG(RAY_ALIAS, "Looping in get_canonical_objref.");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -646,7 +646,7 @@ void SchedulerService::deallocate_object(ObjRef canonical_objref) {
|
||||
// these methods require reference_counts_lock_ to have been acquired, and
|
||||
// so the lock must before outside of these methods (it is acquired in
|
||||
// DecrementRefCount).
|
||||
HALO_LOG(HALO_REFCOUNT, "Deallocating canonical_objref " << canonical_objref << ".");
|
||||
RAY_LOG(RAY_REFCOUNT, "Deallocating canonical_objref " << canonical_objref << ".");
|
||||
{
|
||||
std::lock_guard<std::mutex> objtable_lock(objtable_lock_);
|
||||
auto &objstores = objtable_[canonical_objref];
|
||||
@@ -657,7 +657,7 @@ void SchedulerService::deallocate_object(ObjRef canonical_objref) {
|
||||
DeallocateObjectRequest request;
|
||||
request.set_canonical_objref(canonical_objref);
|
||||
ObjStoreId objstoreid = objstores[i];
|
||||
HALO_LOG(HALO_REFCOUNT, "Attempting to deallocate canonical_objref " << canonical_objref << " from objstore " << objstoreid);
|
||||
RAY_LOG(RAY_REFCOUNT, "Attempting to deallocate canonical_objref " << canonical_objref << " from objstore " << objstoreid);
|
||||
objstores_[objstoreid].objstore_stub->DeallocateObject(&context, request, &reply);
|
||||
}
|
||||
objtable_[canonical_objref].clear();
|
||||
@@ -670,10 +670,10 @@ void SchedulerService::increment_ref_count(std::vector<ObjRef> &objrefs) {
|
||||
for (int i = 0; i < objrefs.size(); ++i) {
|
||||
ObjRef objref = objrefs[i];
|
||||
if (reference_counts_[objref] == DEALLOCATED) {
|
||||
HALO_LOG(HALO_FATAL, "Attempting to increment the reference count for objref " << objref << ", but this object appears to have been deallocated already.");
|
||||
RAY_LOG(RAY_FATAL, "Attempting to increment the reference count for objref " << objref << ", but this object appears to have been deallocated already.");
|
||||
}
|
||||
reference_counts_[objref] += 1;
|
||||
HALO_LOG(HALO_REFCOUNT, "Incremented ref count for objref " << objref <<". New reference count is " << reference_counts_[objref]);
|
||||
RAY_LOG(RAY_REFCOUNT, "Incremented ref count for objref " << objref <<". New reference count is " << reference_counts_[objref]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -682,13 +682,13 @@ void SchedulerService::decrement_ref_count(std::vector<ObjRef> &objrefs) {
|
||||
for (int i = 0; i < objrefs.size(); ++i) {
|
||||
ObjRef objref = objrefs[i];
|
||||
if (reference_counts_[objref] == DEALLOCATED) {
|
||||
HALO_LOG(HALO_FATAL, "Attempting to decrement the reference count for objref " << objref << ", but this object appears to have been deallocated already.");
|
||||
RAY_LOG(RAY_FATAL, "Attempting to decrement the reference count for objref " << objref << ", but this object appears to have been deallocated already.");
|
||||
}
|
||||
if (reference_counts_[objref] == 0) {
|
||||
HALO_LOG(HALO_FATAL, "Attempting to decrement the reference count for objref " << objref << ", but the reference count for this object is already 0.");
|
||||
RAY_LOG(RAY_FATAL, "Attempting to decrement the reference count for objref " << objref << ", but the reference count for this object is already 0.");
|
||||
}
|
||||
reference_counts_[objref] -= 1;
|
||||
HALO_LOG(HALO_REFCOUNT, "Decremented ref count for objref " << objref << ". New reference count is " << reference_counts_[objref]);
|
||||
RAY_LOG(RAY_REFCOUNT, "Decremented ref count for objref " << objref << ". New reference count is " << reference_counts_[objref]);
|
||||
// See if we can deallocate the object
|
||||
std::vector<ObjRef> equivalent_objrefs;
|
||||
get_equivalent_objrefs(objref, equivalent_objrefs);
|
||||
@@ -702,7 +702,7 @@ void SchedulerService::decrement_ref_count(std::vector<ObjRef> &objrefs) {
|
||||
if (can_deallocate) {
|
||||
ObjRef canonical_objref = equivalent_objrefs[0];
|
||||
if (!is_canonical(canonical_objref)) {
|
||||
HALO_LOG(HALO_FATAL, "canonical_objref is not canonical.");
|
||||
RAY_LOG(RAY_FATAL, "canonical_objref is not canonical.");
|
||||
}
|
||||
deallocate_object(canonical_objref);
|
||||
for (int j = 0; j < equivalent_objrefs.size(); ++j) {
|
||||
@@ -724,7 +724,7 @@ void SchedulerService::get_equivalent_objrefs(ObjRef objref, std::vector<ObjRef>
|
||||
std::lock_guard<std::mutex> target_objrefs_lock(target_objrefs_lock_);
|
||||
ObjRef downstream_objref = objref;
|
||||
while (target_objrefs_[downstream_objref] != downstream_objref && target_objrefs_[downstream_objref] != UNITIALIZED_ALIAS) {
|
||||
HALO_LOG(HALO_ALIAS, "Looping in get_equivalent_objrefs");
|
||||
RAY_LOG(RAY_ALIAS, "Looping in get_equivalent_objrefs");
|
||||
downstream_objref = target_objrefs_[downstream_objref];
|
||||
}
|
||||
std::lock_guard<std::mutex> reverse_target_objrefs_lock(reverse_target_objrefs_lock_);
|
||||
@@ -755,7 +755,7 @@ char* get_cmd_option(char** begin, char** end, const std::string& option) {
|
||||
int main(int argc, char** argv) {
|
||||
SchedulingAlgorithmType scheduling_algorithm = SCHEDULING_ALGORITHM_LOCALITY_AWARE;
|
||||
if (argc < 2) {
|
||||
HALO_LOG(HALO_FATAL, "scheduler: expected at least one argument (scheduler ip address)");
|
||||
RAY_LOG(RAY_FATAL, "scheduler: expected at least one argument (scheduler ip address)");
|
||||
return 1;
|
||||
}
|
||||
if (argc > 2) {
|
||||
|
||||
+4
-4
@@ -1,5 +1,5 @@
|
||||
#ifndef HALO_SCHEDULER_H
|
||||
#define HALO_SCHEDULER_H
|
||||
#ifndef RAY_SCHEDULER_H
|
||||
#define RAY_SCHEDULER_H
|
||||
|
||||
|
||||
#include <deque>
|
||||
@@ -10,8 +10,8 @@
|
||||
|
||||
#include <grpc++/grpc++.h>
|
||||
|
||||
#include "halo/halo.h"
|
||||
#include "halo.grpc.pb.h"
|
||||
#include "ray/ray.h"
|
||||
#include "ray.grpc.pb.h"
|
||||
#include "types.pb.h"
|
||||
|
||||
#include "computation_graph.h"
|
||||
|
||||
+4
-4
@@ -1,5 +1,5 @@
|
||||
#ifndef HALO_UTILS_H
|
||||
#define HALO_UTILS_H
|
||||
#ifndef RAY_UTILS_H
|
||||
#define RAY_UTILS_H
|
||||
|
||||
inline std::string::iterator split_ip_address(std::string& ip_address) {
|
||||
if (ip_address[0] == '[') { // IPv6
|
||||
@@ -10,11 +10,11 @@ inline std::string::iterator split_ip_address(std::string& ip_address) {
|
||||
if(split_end != ip_address.end() && *split_end == ':') {
|
||||
return split_end;
|
||||
}
|
||||
HALO_LOG(HALO_FATAL, "ip address should contain a port number");
|
||||
RAY_LOG(RAY_FATAL, "ip address should contain a port number");
|
||||
} else { // IPv4
|
||||
auto split_point = std::find(ip_address.rbegin(), ip_address.rend(), ':').base();
|
||||
if (split_point == ip_address.begin()) {
|
||||
HALO_LOG(HALO_FATAL, "ip address should contain a port number");
|
||||
RAY_LOG(RAY_FATAL, "ip address should contain a port number");
|
||||
} else {
|
||||
return split_point;
|
||||
}
|
||||
|
||||
+21
-21
@@ -5,12 +5,12 @@
|
||||
#include <pynumbuf/serialize.h>
|
||||
|
||||
extern "C" {
|
||||
static PyObject *HaloError;
|
||||
static PyObject *RayError;
|
||||
}
|
||||
|
||||
Status WorkerServiceImpl::ExecuteTask(ServerContext* context, const ExecuteTaskRequest* request, ExecuteTaskReply* reply) {
|
||||
task_ = request->task(); // Copy task
|
||||
HALO_LOG(HALO_INFO, "invoked task " << request->task().name());
|
||||
RAY_LOG(RAY_INFO, "invoked task " << request->task().name());
|
||||
Task* taskptr = &task_;
|
||||
send_queue_.send(&taskptr);
|
||||
return Status::OK;
|
||||
@@ -26,7 +26,7 @@ Worker::Worker(const std::string& worker_address, std::shared_ptr<Channel> sched
|
||||
|
||||
SubmitTaskReply Worker::submit_task(SubmitTaskRequest* request) {
|
||||
if (!connected_) {
|
||||
HALO_LOG(HALO_FATAL, "Attempting to perform submit_task, but connected_ = " << connected_ << ".");
|
||||
RAY_LOG(RAY_FATAL, "Attempting to perform submit_task, but connected_ = " << connected_ << ".");
|
||||
}
|
||||
SubmitTaskReply reply;
|
||||
ClientContext context;
|
||||
@@ -52,7 +52,7 @@ void Worker::register_worker(const std::string& worker_address, const std::strin
|
||||
|
||||
void Worker::request_object(ObjRef objref) {
|
||||
if (!connected_) {
|
||||
HALO_LOG(HALO_FATAL, "Attempting to perform request_object, but connected_ = " << connected_ << ".");
|
||||
RAY_LOG(RAY_FATAL, "Attempting to perform request_object, but connected_ = " << connected_ << ".");
|
||||
}
|
||||
RequestObjRequest request;
|
||||
request.set_workerid(workerid_);
|
||||
@@ -66,7 +66,7 @@ void Worker::request_object(ObjRef objref) {
|
||||
ObjRef Worker::get_objref() {
|
||||
// first get objref for the new object
|
||||
if (!connected_) {
|
||||
HALO_LOG(HALO_FATAL, "Attempting to perform get_objref, but connected_ = " << connected_ << ".");
|
||||
RAY_LOG(RAY_FATAL, "Attempting to perform get_objref, but connected_ = " << connected_ << ".");
|
||||
}
|
||||
PushObjRequest push_request;
|
||||
PushObjReply push_reply;
|
||||
@@ -78,7 +78,7 @@ ObjRef Worker::get_objref() {
|
||||
slice Worker::get_object(ObjRef objref) {
|
||||
// get_object assumes that objref is a canonical objref
|
||||
if (!connected_) {
|
||||
HALO_LOG(HALO_FATAL, "Attempting to perform get_object, but connected_ = " << connected_ << ".");
|
||||
RAY_LOG(RAY_FATAL, "Attempting to perform get_object, but connected_ = " << connected_ << ".");
|
||||
}
|
||||
ObjRequest request;
|
||||
request.workerid = workerid_;
|
||||
@@ -97,7 +97,7 @@ slice Worker::get_object(ObjRef objref) {
|
||||
// contained_objrefs is a vector of all the objrefs contained in obj
|
||||
void Worker::put_object(ObjRef objref, const Obj* obj, std::vector<ObjRef> &contained_objrefs) {
|
||||
if (!connected_) {
|
||||
HALO_LOG(HALO_FATAL, "Attempting to perform put_object, but connected_ = " << connected_ << ".");
|
||||
RAY_LOG(RAY_FATAL, "Attempting to perform put_object, but connected_ = " << connected_ << ".");
|
||||
}
|
||||
std::string data;
|
||||
obj->SerializeToString(&data); // TODO(pcm): get rid of this serialization
|
||||
@@ -108,7 +108,7 @@ void Worker::put_object(ObjRef objref, const Obj* obj, std::vector<ObjRef> &cont
|
||||
request.size = data.size();
|
||||
request_obj_queue_.send(&request);
|
||||
if (contained_objrefs.size() > 0) {
|
||||
HALO_LOG(HALO_REFCOUNT, "In put_object, calling increment_reference_count for contained objrefs");
|
||||
RAY_LOG(RAY_REFCOUNT, "In put_object, calling increment_reference_count for contained objrefs");
|
||||
increment_reference_count(contained_objrefs); // Notify the scheduler that some object references are serialized in the objstore.
|
||||
}
|
||||
ObjHandle result;
|
||||
@@ -135,14 +135,14 @@ void Worker::put_object(ObjRef objref, const Obj* obj, std::vector<ObjRef> &cont
|
||||
arrow::Status _s = (s); \
|
||||
if (!_s.ok()) { \
|
||||
std::string _errmsg = std::string(msg) + _s.ToString(); \
|
||||
PyErr_SetString(HaloError, _errmsg.c_str()); \
|
||||
PyErr_SetString(RayError, _errmsg.c_str()); \
|
||||
return NULL; \
|
||||
} \
|
||||
} while (0);
|
||||
|
||||
PyObject* Worker::put_arrow(ObjRef objref, PyObject* value) {
|
||||
if (!connected_) {
|
||||
HALO_LOG(HALO_FATAL, "Attempting to perform put_arrow, but connected_ = " << connected_ << ".");
|
||||
RAY_LOG(RAY_FATAL, "Attempting to perform put_arrow, but connected_ = " << connected_ << ".");
|
||||
}
|
||||
ObjRequest request;
|
||||
pynumbuf::PythonObjectWriter writer;
|
||||
@@ -168,7 +168,7 @@ PyObject* Worker::put_arrow(ObjRef objref, PyObject* value) {
|
||||
|
||||
PyObject* Worker::get_arrow(ObjRef objref) {
|
||||
if (!connected_) {
|
||||
HALO_LOG(HALO_FATAL, "Attempting to perform get_arrow, but connected_ = " << connected_ << ".");
|
||||
RAY_LOG(RAY_FATAL, "Attempting to perform get_arrow, but connected_ = " << connected_ << ".");
|
||||
}
|
||||
ObjRequest request;
|
||||
request.workerid = workerid_;
|
||||
@@ -186,7 +186,7 @@ PyObject* Worker::get_arrow(ObjRef objref) {
|
||||
|
||||
bool Worker::is_arrow(ObjRef objref) {
|
||||
if (!connected_) {
|
||||
HALO_LOG(HALO_FATAL, "Attempting to perform is_arrow, but connected_ = " << connected_ << ".");
|
||||
RAY_LOG(RAY_FATAL, "Attempting to perform is_arrow, but connected_ = " << connected_ << ".");
|
||||
}
|
||||
ObjRequest request;
|
||||
request.workerid = workerid_;
|
||||
@@ -200,7 +200,7 @@ bool Worker::is_arrow(ObjRef objref) {
|
||||
|
||||
void Worker::alias_objrefs(ObjRef alias_objref, ObjRef target_objref) {
|
||||
if (!connected_) {
|
||||
HALO_LOG(HALO_FATAL, "Attempting to perform alias_objrefs, but connected_ = " << connected_ << ".");
|
||||
RAY_LOG(RAY_FATAL, "Attempting to perform alias_objrefs, but connected_ = " << connected_ << ".");
|
||||
}
|
||||
ClientContext context;
|
||||
AliasObjRefsRequest request;
|
||||
@@ -212,14 +212,14 @@ void Worker::alias_objrefs(ObjRef alias_objref, ObjRef target_objref) {
|
||||
|
||||
void Worker::increment_reference_count(std::vector<ObjRef> &objrefs) {
|
||||
if (!connected_) {
|
||||
HALO_LOG(HALO_DEBUG, "Attempting to increment_reference_count for objrefs, but connected_ = " << connected_ << " so returning instead.");
|
||||
RAY_LOG(RAY_DEBUG, "Attempting to increment_reference_count for objrefs, but connected_ = " << connected_ << " so returning instead.");
|
||||
return;
|
||||
}
|
||||
if (objrefs.size() > 0) {
|
||||
ClientContext context;
|
||||
IncrementRefCountRequest request;
|
||||
for (int i = 0; i < objrefs.size(); ++i) {
|
||||
HALO_LOG(HALO_REFCOUNT, "Incrementing reference count for objref " << objrefs[i]);
|
||||
RAY_LOG(RAY_REFCOUNT, "Incrementing reference count for objref " << objrefs[i]);
|
||||
request.add_objref(objrefs[i]);
|
||||
}
|
||||
AckReply reply;
|
||||
@@ -229,14 +229,14 @@ void Worker::increment_reference_count(std::vector<ObjRef> &objrefs) {
|
||||
|
||||
void Worker::decrement_reference_count(std::vector<ObjRef> &objrefs) {
|
||||
if (!connected_) {
|
||||
HALO_LOG(HALO_DEBUG, "Attempting to decrement_reference_count, but connected_ = " << connected_ << " so returning instead.");
|
||||
RAY_LOG(RAY_DEBUG, "Attempting to decrement_reference_count, but connected_ = " << connected_ << " so returning instead.");
|
||||
return;
|
||||
}
|
||||
if (objrefs.size() > 0) {
|
||||
ClientContext context;
|
||||
DecrementRefCountRequest request;
|
||||
for (int i = 0; i < objrefs.size(); ++i) {
|
||||
HALO_LOG(HALO_REFCOUNT, "Decrementing reference count for objref " << objrefs[i]);
|
||||
RAY_LOG(RAY_REFCOUNT, "Decrementing reference count for objref " << objrefs[i]);
|
||||
request.add_objref(objrefs[i]);
|
||||
}
|
||||
AckReply reply;
|
||||
@@ -246,7 +246,7 @@ void Worker::decrement_reference_count(std::vector<ObjRef> &objrefs) {
|
||||
|
||||
void Worker::register_function(const std::string& name, size_t num_return_vals) {
|
||||
if (!connected_) {
|
||||
HALO_LOG(HALO_FATAL, "Attempting to perform register_function, but connected_ = " << connected_ << ".");
|
||||
RAY_LOG(RAY_FATAL, "Attempting to perform register_function, but connected_ = " << connected_ << ".");
|
||||
}
|
||||
ClientContext context;
|
||||
RegisterFunctionRequest request;
|
||||
@@ -265,7 +265,7 @@ Task* Worker::receive_next_task() {
|
||||
|
||||
void Worker::notify_task_completed() {
|
||||
if (!connected_) {
|
||||
HALO_LOG(HALO_FATAL, "Attempting to perform notify_task_completed, but connected_ = " << connected_ << ".");
|
||||
RAY_LOG(RAY_FATAL, "Attempting to perform notify_task_completed, but connected_ = " << connected_ << ".");
|
||||
}
|
||||
ClientContext context;
|
||||
WorkerReadyRequest request;
|
||||
@@ -285,7 +285,7 @@ bool Worker::connected() {
|
||||
// TODO(rkn): Should we be using pointers or references? And should they be const?
|
||||
void Worker::scheduler_info(ClientContext &context, SchedulerInfoRequest &request, SchedulerInfoReply &reply) {
|
||||
if (!connected_) {
|
||||
HALO_LOG(HALO_FATAL, "Attempting to get scheduler info, but connected_ = " << connected_ << ".");
|
||||
RAY_LOG(RAY_FATAL, "Attempting to get scheduler info, but connected_ = " << connected_ << ".");
|
||||
}
|
||||
scheduler_stub_->SchedulerInfo(&context, request, &reply);
|
||||
}
|
||||
@@ -306,7 +306,7 @@ void Worker::start_worker_service() {
|
||||
builder.AddListeningPort(std::string("0.0.0.0:") + port, grpc::InsecureServerCredentials());
|
||||
builder.RegisterService(&service);
|
||||
std::unique_ptr<Server> server(builder.BuildAndStart());
|
||||
HALO_LOG(HALO_INFO, "worker server listening on " << service_address);
|
||||
RAY_LOG(RAY_INFO, "worker server listening on " << service_address);
|
||||
server->Wait();
|
||||
});
|
||||
}
|
||||
|
||||
+4
-4
@@ -1,5 +1,5 @@
|
||||
#ifndef HALO_WORKER_H
|
||||
#define HALO_WORKER_H
|
||||
#ifndef RAY_WORKER_H
|
||||
#define RAY_WORKER_H
|
||||
|
||||
#include <iostream>
|
||||
#include <memory>
|
||||
@@ -15,8 +15,8 @@ using grpc::ServerBuilder;
|
||||
using grpc::ServerContext;
|
||||
using grpc::Status;
|
||||
|
||||
#include "halo.grpc.pb.h"
|
||||
#include "halo/halo.h"
|
||||
#include "ray.grpc.pb.h"
|
||||
#include "ray/ray.h"
|
||||
#include "ipc.h"
|
||||
|
||||
using grpc::Channel;
|
||||
|
||||
Reference in New Issue
Block a user