Merge pull request #52 from amplab/logging

reduce the amount of logging
This commit is contained in:
Robert Nishihara
2016-04-22 12:59:18 -07:00
6 changed files with 20 additions and 23 deletions
+4
View File
@@ -37,6 +37,8 @@ typedef std::unordered_map<std::string, FnInfo> FnTable;
#define ORCH_INFO 0
#define ORCH_DEBUG 1
#define ORCH_FATAL 2
#define ORCH_REFCOUNT ORCH_VERBOSE
#define ORCH_ALIAS ORCH_VERBOSE
#define ORCH_LOG(LEVEL, MESSAGE) \
if (LEVEL == ORCH_VERBOSE) { \
@@ -44,6 +46,8 @@ typedef std::unordered_map<std::string, FnInfo> FnTable;
} else if (LEVEL == ORCH_FATAL) { \
std::cerr << "fatal error occured: " << MESSAGE << std::endl; \
std::exit(1); \
} else if (LEVEL == ORCH_DEBUG) { \
\
} else { \
std::cout << MESSAGE << std::endl; \
}
+2 -2
View File
@@ -31,7 +31,7 @@ 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) {
ORCH_LOG(ORCH_DEBUG, "OPENING segmentid " << segmentid);
ORCH_LOG(ORCH_DEBUG, "opening segmentid " << segmentid);
if (segmentid != segments_.size() && create_mode_) {
ORCH_LOG(ORCH_FATAL, "Attempting to open segmentid " << segmentid << " on the object store, but segments_.size() = " << segments_.size());
}
@@ -61,7 +61,7 @@ void MemorySegmentPool::open_segment(SegmentId segmentid, size_t size) {
}
void MemorySegmentPool::close_segment(SegmentId segmentid) {
ORCH_LOG(ORCH_DEBUG, "CLOSING segmentid " << segmentid);
ORCH_LOG(ORCH_DEBUG, "closing segmentid " << segmentid);
std::string segment_name = get_segment_name(segmentid);
shared_memory_object::remove(segment_name.c_str());
segments_[segmentid].first.reset();
+1 -1
View File
@@ -146,7 +146,7 @@ Status ObjStoreService::NotifyAlias(ServerContext* context, const NotifyAliasReq
Status ObjStoreService::DeallocateObject(ServerContext* context, const DeallocateObjectRequest* request, AckReply* reply) {
ObjRef canonical_objref = request->canonical_objref();
ORCH_LOG(ORCH_DEBUG, "Deallocating canonical_objref " << canonical_objref);
ORCH_LOG(ORCH_REFCOUNT, "Deallocating canonical_objref " << canonical_objref);
std::lock_guard<std::mutex> memory_lock(memory_lock_);
if (memory_[canonical_objref].second != MemoryStatusType::READY) {
ORCH_LOG(ORCH_FATAL, "Attempting to deallocate canonical_objref " << canonical_objref << ", but memory_[canonical_objref].second = " << memory_[canonical_objref].second);
+2 -5
View File
@@ -47,7 +47,7 @@ static int PyObjRef_init(PyObjRef *self, PyObject *args, PyObject *kwds) {
}
std::vector<ObjRef> objrefs;
objrefs.push_back(self->val);
ORCH_LOG(ORCH_DEBUG, "In PyObjRef_init, calling increment_reference_count for objref " << objrefs[0]);
ORCH_LOG(ORCH_REFCOUNT, "In PyObjRef_init, calling increment_reference_count for objref " << objrefs[0]);
self->worker->increment_reference_count(objrefs);
return 0;
};
@@ -530,10 +530,7 @@ PyObject* serialize_call(PyObject* self, PyObject* args) {
Worker* worker;
PyObjectToWorker(worker_capsule, &worker);
if (objrefs.size() > 0) {
ORCH_LOG(ORCH_DEBUG, "In serialize_call, calling increment_reference_count for objrefs:");
for (int i = 0; i < objrefs.size(); ++i) {
ORCH_LOG(ORCH_DEBUG, "----" << objrefs[i]);
}
ORCH_LOG(ORCH_REFCOUNT, "In serialize_call, calling increment_reference_count for contained objrefs");
worker->increment_reference_count(objrefs);
}
return PyCapsule_New(static_cast<void*>(call), "call", &CallCapsule_Destructor);
+8 -9
View File
@@ -65,7 +65,7 @@ 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();
ORCH_LOG(ORCH_DEBUG, "Aliasing objref " << alias_objref << " with objref " << target_objref);
ORCH_LOG(ORCH_ALIAS, "Aliasing objref " << alias_objref << " with objref " << target_objref);
if (alias_objref == target_objref) {
ORCH_LOG(ORCH_FATAL, "internal error: attempting to alias objref " << alias_objref << " with itself.");
}
@@ -233,7 +233,7 @@ void SchedulerService::submit_task(std::unique_ptr<Call> call, WorkerId workerid
}
attempt_notify_alias(get_store(workerid), objref, canonical_objref);
ORCH_LOG(ORCH_INFO, "call contains object ref " << canonical_objref);
ORCH_LOG(ORCH_DEBUG, "call 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_);
@@ -429,7 +429,7 @@ void SchedulerService::perform_pulls() {
ObjRef objref = pull.second;
WorkerId workerid = pull.first;
if (!has_canonical_objref(objref)) {
ORCH_LOG(ORCH_DEBUG, "objref " << objref << " does not have a canonical_objref, so continuing");
ORCH_LOG(ORCH_ALIAS, "objref " << objref << " does not have a canonical_objref, so continuing");
continue;
}
ObjRef canonical_objref = get_canonical_objref(objref);
@@ -535,7 +535,7 @@ ObjRef SchedulerService::get_canonical_objref(ObjRef objref) {
return objref_temp;
}
objref_temp = target_objrefs_[objref_temp];
ORCH_LOG(ORCH_DEBUG, "Looping in get_canonical_objref.");
ORCH_LOG(ORCH_ALIAS, "Looping in get_canonical_objref.");
}
}
@@ -569,7 +569,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).
ORCH_LOG(ORCH_DEBUG, "Deallocating canonical_objref " << canonical_objref << ".");
ORCH_LOG(ORCH_REFCOUNT, "Deallocating canonical_objref " << canonical_objref << ".");
ClientContext context;
AckReply reply;
DeallocateObjectRequest request;
@@ -594,7 +594,7 @@ void SchedulerService::increment_ref_count(std::vector<ObjRef> &objrefs) {
ORCH_LOG(ORCH_FATAL, "Attempting to increment the reference count for objref " << objref << ", but this object appears to have been deallocated already.");
}
reference_counts_[objref] += 1;
ORCH_LOG(ORCH_DEBUG, "Incremented ref count for objref " << objref <<". New reference count is " << reference_counts_[objref]);
ORCH_LOG(ORCH_REFCOUNT, "Incremented ref count for objref " << objref <<". New reference count is " << reference_counts_[objref]);
}
}
@@ -609,7 +609,7 @@ void SchedulerService::decrement_ref_count(std::vector<ObjRef> &objrefs) {
ORCH_LOG(ORCH_FATAL, "Attempting to decrement the reference count for objref " << objref << ", but the reference count for this object is already 0.");
}
reference_counts_[objref] -= 1;
ORCH_LOG(ORCH_DEBUG, "Decremented ref count for objref " << objref << ". New reference count is " << reference_counts_[objref]);
ORCH_LOG(ORCH_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);
@@ -631,7 +631,6 @@ void SchedulerService::decrement_ref_count(std::vector<ObjRef> &objrefs) {
}
}
}
ORCH_LOG(ORCH_DEBUG, "Exiting decrement_ref_count");
}
void SchedulerService::upstream_objrefs(ObjRef objref, std::vector<ObjRef> &objrefs) {
@@ -646,7 +645,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) {
ORCH_LOG(ORCH_DEBUG, "Looping in get_equivalent_objrefs");
ORCH_LOG(ORCH_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_);
+3 -6
View File
@@ -100,10 +100,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) {
ORCH_LOG(ORCH_DEBUG, "In put_object, calling increment_reference_count for objrefs:");
for (int i = 0; i < contained_objrefs.size(); ++i){
ORCH_LOG(ORCH_DEBUG, "----" << contained_objrefs[i]);
}
ORCH_LOG(ORCH_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;
@@ -192,7 +189,7 @@ void Worker::increment_reference_count(std::vector<ObjRef> &objrefs) {
ClientContext context;
IncrementRefCountRequest request;
for (int i = 0; i < objrefs.size(); ++i) {
ORCH_LOG(ORCH_DEBUG, "Incrementing reference count for objref " << objrefs[i]);
ORCH_LOG(ORCH_REFCOUNT, "Incrementing reference count for objref " << objrefs[i]);
request.add_objref(objrefs[i]);
}
AckReply reply;
@@ -207,7 +204,7 @@ void Worker::decrement_reference_count(std::vector<ObjRef> &objrefs) {
ClientContext context;
DecrementRefCountRequest request;
for (int i = 0; i < objrefs.size(); ++i) {
ORCH_LOG(ORCH_DEBUG, "Decrementing reference count for objref " << objrefs[i]);
ORCH_LOG(ORCH_REFCOUNT, "Decrementing reference count for objref " << objrefs[i]);
request.add_objref(objrefs[i]);
}
AckReply reply;