Skip to content

Commit

Permalink
Add new callback to log plan fragment from TaskListener
Browse files Browse the repository at this point in the history
Summary: We would like to use TaskListener framework to log the planfragmant along with task stats and other details. To accomplish that, we need an override of TaskListner::onTaskCompletion() which takes planFragment.

Differential Revision: D65468501
  • Loading branch information
pansatadru authored and facebook-github-bot committed Nov 6, 2024
1 parent c3023b6 commit d41a19d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
3 changes: 2 additions & 1 deletion velox/exec/Task.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2309,7 +2309,8 @@ void Task::onTaskCompletion() {
}

for (auto& listener : listeners) {
listener->onTaskCompletion(uuid_, taskId_, state, exception, stats);
listener->onTaskCompletion(
uuid_, taskId_, state, exception, stats, planFragment_);
}
});
}
Expand Down
11 changes: 11 additions & 0 deletions velox/exec/Task.h
Original file line number Diff line number Diff line change
Expand Up @@ -1196,6 +1196,17 @@ class TaskListener {
TaskState state,
std::exception_ptr error,
TaskStats stats) = 0;

// onTaskCompletion() overload for the case when we pass PlanFragment
virtual void onTaskCompletion(
const std::string& taskUuid,
const std::string& taskId,
TaskState state,
std::exception_ptr error,
const TaskStats& stats,
core::PlanFragment& /*fragment*/) {
onTaskCompletion(taskUuid, taskId, state, error, stats);
}
};

/// Register a listener to be invoked on task completion. Returns true if
Expand Down

0 comments on commit d41a19d

Please sign in to comment.