Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Chore](pipeline) set PipelineFragmentContext::_timeout and adjust dump_pipeline_tasks infomation display #35328

Merged
merged 2 commits into from
May 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions be/src/pipeline/pipeline_fragment_context.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,10 @@ Status PipelineFragmentContext::prepare(const doris::TPipelineFragmentParams& re
if (_prepared) {
return Status::InternalError("Already prepared");
}
if (request.__isset.query_options && request.query_options.__isset.execution_timeout) {
_timeout = request.query_options.execution_timeout;
}

_runtime_profile = std::make_unique<RuntimeProfile>("PipelineContext");
_prepare_timer = ADD_TIMER(_runtime_profile, "PrepareTime");
SCOPED_TIMER(_prepare_timer);
Expand Down
2 changes: 2 additions & 0 deletions be/src/pipeline/pipeline_fragment_context.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@ class PipelineFragmentContext : public TaskExecutionContext {

uint64_t elapsed_time() const { return _fragment_watcher.elapsed_time(); }

int timeout_second() const { return _timeout; }

PipelinePtr add_pipeline();

PipelinePtr add_pipeline(PipelinePtr parent, int idx = -1);
Expand Down
16 changes: 12 additions & 4 deletions be/src/runtime/fragment_mgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -814,16 +814,24 @@ std::string FragmentMgr::dump_pipeline_tasks(int64_t duration) {
size_t i = 0;
{
std::lock_guard<std::mutex> lock(_lock);
fmt::format_to(debug_string_buffer, "{} pipeline fragment contexts are still running!\n",
_pipeline_map.size());
fmt::format_to(debug_string_buffer,
"{} pipeline fragment contexts are still running! duration_limit={}\n",
_pipeline_map.size(), duration);

timespec now;
clock_gettime(CLOCK_MONOTONIC, &now);
for (auto& it : _pipeline_map) {
auto elapsed = it.second->elapsed_time() / 1000000000.0;
if (elapsed < duration) {
// Only display tasks which has been running for more than {duration} seconds.
continue;
}
fmt::format_to(debug_string_buffer, "No.{} (elapse time = {}s, InstanceId = {}) : {}\n",
i, elapsed, print_id(it.first), it.second->debug_string());
auto timeout_second = it.second->timeout_second();
fmt::format_to(debug_string_buffer,
"No.{} (elapse_second={}s, query_timeout_second={}s, instance_id="
"{}, is_timeout={}) : {}\n",
i, elapsed, timeout_second, print_id(it.first),
it.second->is_timeout(now), it.second->debug_string());
i++;
}
}
Expand Down
Loading