xinyiZzz commented on code in PR #50107: URL: https://github.com/apache/doris/pull/50107#discussion_r2051926398
########## be/src/runtime/workload_management/task_controller.h: ########## @@ -25,50 +25,138 @@ #include "util/time.h" namespace doris { +#include "common/compile_check_begin.h" +namespace pipeline { +class PipelineTask; +} // namespace pipeline +class ResourceContext; class TaskController { ENABLE_FACTORY_CREATOR(TaskController); public: - TaskController() { - task_id_ = TUniqueId(); - start_time_ = MonotonicMillis(); - }; + TaskController() { task_id_ = TUniqueId(); }; virtual ~TaskController() = default; - bool is_attach_task() { return task_id_ != TUniqueId(); } + /* common action + */ + bool is_attach_task() const { return is_attached_; } const TUniqueId& task_id() const { return task_id_; } - void set_task_id(TUniqueId task_id) { task_id_ = task_id; } - - virtual bool is_cancelled() const { return is_cancelled_; } - virtual Status cancel(const Status& reason) { - is_cancelled_ = true; - return Status::OK(); + void set_task_id(TUniqueId task_id) { + is_attached_ = true; + task_id_ = task_id; + start_time_ = MonotonicMillis(); } + TQueryType::type query_type() { return query_type_; } + void set_query_type(TQueryType::type query_type) { query_type_ = query_type; } + TNetworkAddress fe_addr() { return fe_addr_; } + void set_fe_addr(TNetworkAddress fe_addr) { fe_addr_ = fe_addr; } + std::string debug_string(); - virtual bool is_finished() const { return is_finished_; } - virtual void finish() { - is_finished_ = true; - finish_time_ = MonotonicMillis(); + /* finish action + */ + bool is_finished() const { return is_finished_; } + void set_is_finished() { + if (!is_finished_) { + is_finished_ = true; + finish_time_ = MonotonicMillis(); + } } - + virtual void finish() { set_is_finished(); } int64_t start_time() const { return start_time_; } int64_t finish_time() const { return finish_time_; } - int64_t running_time() const { return finish_time_ - start_time_; } - TNetworkAddress fe_addr() { return fe_addr_; } - TQueryType::type query_type() { return query_type_; } + int64_t running_time() const { return finish_time() - start_time(); } - void set_fe_addr(TNetworkAddress fe_addr) { fe_addr_ = fe_addr; } - void set_query_type(TQueryType::type query_type) { query_type_ = query_type; } + /* cancel action + */ + bool is_cancelled() const { return is_cancelled_; } + void set_is_cancelled() { Review Comment: 因为 cancel() 可以被重载,我怕有人重载后忘记修改 cancel 状态和时间,所以抽了出来 -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org