Skip to content

Commit

Permalink
NED
Browse files Browse the repository at this point in the history
  • Loading branch information
zhiqiang-hhhh committed Nov 4, 2024
1 parent b364157 commit 7eb8642
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
16 changes: 12 additions & 4 deletions be/src/vec/exec/scan/scanner_scheduler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -392,6 +392,12 @@ SimplifiedScanScheduler::SimplifiedScanScheduler(std::string sched_name, CgroupC
INT_GAUGE_METRIC_REGISTER(_metric_entity, scan_scheduler_max_thread_number);
}

SimplifiedScanScheduler::~SimplifiedScanScheduler() {
stop();
LOG(INFO) << "Scanner sche " << _sched_name << " shutdown";
DorisMetrics::instance()->metric_registry()->deregister_entity(_metric_entity);
}

Status SimplifiedScanScheduler::start(int max_thread_num, int min_thread_num, int queue_size) {
RETURN_IF_ERROR(ThreadPoolBuilder(_sched_name)
.set_min_threads(min_thread_num)
Expand All @@ -401,10 +407,12 @@ Status SimplifiedScanScheduler::start(int max_thread_num, int min_thread_num, in
.build(&_scan_thread_pool));

_metric_entity->register_hook("update", [this]() {
this->scan_scheduler_running_tasks->set_value(_scan_thread_pool->num_active_threads());
this->scan_scheduler_queue_size->set_value(_scan_thread_pool->get_queue_size());
this->scan_scheduler_queue_capacity->set_value(_scan_thread_pool->get_max_queue_size());
this->scan_scheduler_max_thread_number->set_value(_scan_thread_pool->max_threads());
if (_scan_thread_pool != nullptr) {
this->scan_scheduler_running_tasks->set_value(_scan_thread_pool->num_active_threads());
this->scan_scheduler_queue_size->set_value(_scan_thread_pool->get_queue_size());
this->scan_scheduler_queue_capacity->set_value(_scan_thread_pool->get_max_queue_size());
this->scan_scheduler_max_thread_number->set_value(_scan_thread_pool->max_threads());
}
});

return Status::OK();
Expand Down
5 changes: 1 addition & 4 deletions be/src/vec/exec/scan/scanner_scheduler.h
Original file line number Diff line number Diff line change
Expand Up @@ -117,10 +117,7 @@ class SimplifiedScanScheduler {
public:
SimplifiedScanScheduler(std::string sched_name, CgroupCpuCtl* cgroup_cpu_ctl);

~SimplifiedScanScheduler() {
stop();
LOG(INFO) << "Scanner sche " << _sched_name << " shutdown";
}
~SimplifiedScanScheduler();

void stop() {
_is_stop.store(true);
Expand Down

0 comments on commit 7eb8642

Please sign in to comment.