zhiqiang-hhhh commented on code in PR #31448:
URL: https://github.com/apache/doris/pull/31448#discussion_r1505252281


##########
be/src/runtime/task_execution_context.cpp:
##########
@@ -0,0 +1,291 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+#include "runtime/task_execution_context.h"
+
+#include <thrift/protocol/TDebugProtocol.h>
+#include <thrift/transport/TTransportException.h>
+
+#include <memory>
+
+#include "runtime/client_cache.h"
+#include "runtime/exec_env.h"
+#include "runtime/fragment_mgr.h"
+#include "service/backend_options.h"
+
+namespace doris {
+std::string to_http_path(const std::string& file_name) {
+    std::stringstream url;
+    url << "http://"; << BackendOptions::get_localhost() << ":" << 
config::webserver_port
+        << "/api/_download_load?"
+        << "token=" << ExecEnv::GetInstance()->token() << "&file=" << 
file_name;
+    return url.str();
+};
+
+Status TaskExecutionContext::trigger_profile_report(
+        std::shared_ptr<doris::ReportStatusRequest> request) {
+    // Create a shared pointer to capture and extend the lifetime of 
TaskExecutionContext
+    auto shared_this = shared_from_this();
+
+    auto report_profile_task = [shared_this, request]() {
+        shared_this->do_report_profile(request);
+
+        if (!request->done) {
+            shared_this->refresh_next_report_time();
+        }
+    };
+
+    return 
ExecEnv::GetInstance()->fragment_mgr()->submit_report_profile_task(report_profile_task);
+};
+
+void 
TaskExecutionContext::do_report_profile(std::shared_ptr<doris::ReportStatusRequest>
 req) {

Review Comment:
   can not be static since we need to extend lifetime of object



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to