Coverage Report

Created: 2026-04-14 13:42

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
be/src/runtime/workload_management/task_controller.cpp
Line
Count
Source
1
// Licensed to the Apache Software Foundation (ASF) under one
2
// or more contributor license agreements.  See the NOTICE file
3
// distributed with this work for additional information
4
// regarding copyright ownership.  The ASF licenses this file
5
// to you under the Apache License, Version 2.0 (the
6
// "License"); you may not use this file except in compliance
7
// with the License.  You may obtain a copy of the License at
8
//
9
//   http://www.apache.org/licenses/LICENSE-2.0
10
//
11
// Unless required by applicable law or agreed to in writing,
12
// software distributed under the License is distributed on an
13
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14
// KIND, either express or implied.  See the License for the
15
// specific language governing permissions and limitations
16
// under the License.
17
18
#include "runtime/workload_management/task_controller.h"
19
20
#include "runtime/workload_management/resource_context.h"
21
22
namespace doris {
23
24
29
void TaskController::update_paused_reason(const Status& st) {
25
29
    if (paused_reason_.status().is<ErrorCode::QUERY_MEMORY_EXCEEDED>()) {
26
0
        return;
27
29
    } else if (paused_reason_.status().is<ErrorCode::WORKLOAD_GROUP_MEMORY_EXCEEDED>()) {
28
0
        if (st.is<ErrorCode::QUERY_MEMORY_EXCEEDED>()) {
29
0
            paused_reason_.update(st);
30
0
            return;
31
0
        } else {
32
0
            return;
33
0
        }
34
29
    } else {
35
29
        paused_reason_.update(st);
36
29
    }
37
29
}
38
39
88
std::string TaskController::debug_string() {
40
88
    return fmt::format(
41
88
            "TaskId={}, Memory(Used={}, Limit={}, Peak={}), Spill(RunningSpillTaskCnt={}, "
42
88
            "TotalPausedPeriodSecs={}, LatestPausedReason={})",
43
88
            print_id(task_id_),
44
88
            PrettyPrinter::print_bytes(resource_ctx_->memory_context()->current_memory_bytes()),
45
88
            PrettyPrinter::print_bytes(resource_ctx_->memory_context()->mem_limit()),
46
88
            PrettyPrinter::print_bytes(resource_ctx_->memory_context()->peak_memory_bytes()),
47
88
            revoking_tasks_count_, memory_sufficient_time() / NANOS_PER_SEC,
48
88
            paused_reason_.status().to_string());
49
88
}
50
51
} // namespace doris