From 3dc34ad30ede278e5f059dac3db86100b8c1f73b Mon Sep 17 00:00:00 2001 From: BiteTheDDDDt Date: Fri, 24 May 2024 11:05:58 +0800 Subject: [PATCH 1/2] adjust dump_pipeline_tasks infomation display --- be/src/pipeline/pipeline_fragment_context.h | 2 ++ be/src/runtime/fragment_mgr.cpp | 16 ++++++++++++---- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/be/src/pipeline/pipeline_fragment_context.h b/be/src/pipeline/pipeline_fragment_context.h index 1044282289bcec..03f405e04018e8 100644 --- a/be/src/pipeline/pipeline_fragment_context.h +++ b/be/src/pipeline/pipeline_fragment_context.h @@ -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); diff --git a/be/src/runtime/fragment_mgr.cpp b/be/src/runtime/fragment_mgr.cpp index a75615e772ea89..b03c23bc97cfea 100644 --- a/be/src/runtime/fragment_mgr.cpp +++ b/be/src/runtime/fragment_mgr.cpp @@ -814,16 +814,24 @@ std::string FragmentMgr::dump_pipeline_tasks(int64_t duration) { size_t i = 0; { std::lock_guard 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++; } } From 658868685694078f3ac37f67493c714a6b8138c6 Mon Sep 17 00:00:00 2001 From: BiteTheDDDDt Date: Fri, 24 May 2024 11:37:21 +0800 Subject: [PATCH 2/2] update --- be/src/pipeline/pipeline_fragment_context.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/be/src/pipeline/pipeline_fragment_context.cpp b/be/src/pipeline/pipeline_fragment_context.cpp index 54ab15041b0b99..0d34bf3ebdbca3 100644 --- a/be/src/pipeline/pipeline_fragment_context.cpp +++ b/be/src/pipeline/pipeline_fragment_context.cpp @@ -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("PipelineContext"); _prepare_timer = ADD_TIMER(_runtime_profile, "PrepareTime"); SCOPED_TIMER(_prepare_timer);