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 | | #include "common/compile_check_begin.h" |
24 | | |
25 | 10 | void TaskController::update_paused_reason(const Status& st) { |
26 | 10 | if (paused_reason_.status().is<ErrorCode::QUERY_MEMORY_EXCEEDED>()) { |
27 | 0 | return; |
28 | 10 | } else if (paused_reason_.status().is<ErrorCode::WORKLOAD_GROUP_MEMORY_EXCEEDED>()) { |
29 | 0 | if (st.is<ErrorCode::QUERY_MEMORY_EXCEEDED>()) { |
30 | 0 | paused_reason_.update(st); |
31 | 0 | return; |
32 | 0 | } else { |
33 | 0 | return; |
34 | 0 | } |
35 | 10 | } else { |
36 | 10 | paused_reason_.update(st); |
37 | 10 | } |
38 | 10 | } |
39 | | |
40 | 59 | std::string TaskController::debug_string() { |
41 | 59 | return fmt::format( |
42 | 59 | "TaskId={}, Memory(Used={}, Limit={}, Peak={}), Spill(RunningSpillTaskCnt={}, " |
43 | 59 | "TotalPausedPeriodSecs={}, LatestPausedReason={})", |
44 | 59 | print_id(task_id_), |
45 | 59 | PrettyPrinter::print_bytes(resource_ctx_->memory_context()->current_memory_bytes()), |
46 | 59 | PrettyPrinter::print_bytes(resource_ctx_->memory_context()->mem_limit()), |
47 | 59 | PrettyPrinter::print_bytes(resource_ctx_->memory_context()->peak_memory_bytes()), |
48 | 59 | revoking_tasks_count_, memory_sufficient_time() / NANOS_PER_SEC, |
49 | 59 | paused_reason_.status().to_string()); |
50 | 59 | } |
51 | | |
52 | | #include "common/compile_check_end.h" |
53 | | } // namespace doris |