Skip to content

Commit

Permalink
fixup! Overhaul logging mechanism
Browse files Browse the repository at this point in the history
  • Loading branch information
psalz committed Jan 26, 2022
1 parent 0fe0f53 commit 5864d74
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions include/worker_job.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ namespace detail {

class worker_job {
public:
worker_job(command_pkg pkg) : pkg(pkg), lctx({{"job", pkg.cid}}) {}
worker_job(const worker_job&) = delete;
worker_job(worker_job&&) = delete;

Expand All @@ -36,6 +35,9 @@ namespace detail {
bool is_running() const { return running; }
bool is_done() const { return done; }

protected:
worker_job(command_pkg pkg, log_map ctx = {}) : pkg(pkg), lctx((ctx.insert({"job", pkg.cid}), ctx)) {}

private:
command_pkg pkg;
log_context lctx;
Expand Down Expand Up @@ -100,7 +102,9 @@ namespace detail {

class reduction_job : public worker_job {
public:
reduction_job(command_pkg pkg, reduction_manager& rm) : worker_job(pkg), rm(rm) { assert(pkg.cmd == command_type::REDUCTION); }
reduction_job(command_pkg pkg, reduction_manager& rm) : worker_job(pkg, {{"tid", std::get<task_data>(pkg.data).tid}}), rm(rm) {
assert(pkg.cmd == command_type::REDUCTION);
}

private:
reduction_manager& rm;
Expand All @@ -113,7 +117,7 @@ namespace detail {
class host_execute_job : public worker_job {
public:
host_execute_job(command_pkg pkg, detail::host_queue& queue, detail::task_manager& tm, buffer_manager& bm)
: worker_job(pkg), queue(queue), task_mngr(tm), buffer_mngr(bm) {
: worker_job(pkg, {{"tid", std::get<task_data>(pkg.data).tid}}), queue(queue), task_mngr(tm), buffer_mngr(bm) {
assert(pkg.cmd == command_type::TASK);
}

Expand All @@ -135,7 +139,8 @@ namespace detail {
class device_execute_job : public worker_job {
public:
device_execute_job(command_pkg pkg, detail::device_queue& queue, detail::task_manager& tm, buffer_manager& bm, reduction_manager& rm, node_id local_nid)
: worker_job(pkg), queue(queue), task_mngr(tm), buffer_mngr(bm), reduction_mngr(rm), local_nid(local_nid) {
: worker_job(pkg, {{"tid", std::get<task_data>(pkg.data).tid}}), queue(queue), task_mngr(tm), buffer_mngr(bm), reduction_mngr(rm),
local_nid(local_nid) {
assert(pkg.cmd == command_type::TASK);
}

Expand Down

0 comments on commit 5864d74

Please sign in to comment.