You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by wu...@apache.org on 2022/11/21 15:48:23 UTC

[ambari] branch trunk updated: AMBARI-25589: When hearbeat is lost sometimes start/stop tasks can hang for a long time (#3539)

This is an automated email from the ASF dual-hosted git repository.

wuzhiguo pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/ambari.git


The following commit(s) were added to refs/heads/trunk by this push:
     new 81d94c6e6e AMBARI-25589: When hearbeat is lost sometimes start/stop tasks can hang for a long time (#3539)
81d94c6e6e is described below

commit 81d94c6e6efef2144aa94c508c1068cf05f56854
Author: stdnt-xiao <17...@qq.com>
AuthorDate: Mon Nov 21 23:48:15 2022 +0800

    AMBARI-25589: When hearbeat is lost sometimes start/stop tasks can hang for a long time (#3539)
---
 .../main/python/ambari_agent/CommandStatusDict.py    | 20 +++++++++-----------
 1 file changed, 9 insertions(+), 11 deletions(-)

diff --git a/ambari-agent/src/main/python/ambari_agent/CommandStatusDict.py b/ambari-agent/src/main/python/ambari_agent/CommandStatusDict.py
index d27dad44d3..89d0a3daf7 100644
--- a/ambari-agent/src/main/python/ambari_agent/CommandStatusDict.py
+++ b/ambari-agent/src/main/python/ambari_agent/CommandStatusDict.py
@@ -68,19 +68,17 @@ class CommandStatusDict():
     """
     Stores new version of report for command (replaces previous)
     """
-    from ActionQueue import ActionQueue
-
-    key = command['taskId']
-    # delete stale data about this command
-    self.delete_command_data(key)
+    with self.lock:
+      key = command['taskId']
+      # delete stale data about this command
+      self.delete_command_data(key)
+      self.queue_report_sending(key, command, report)
 
-    is_sent, correlation_id = self.force_update_to_server({command['clusterId']: [report]})
-    updatable = report['status'] == CommandStatus.in_progress and self.command_update_output
+      report_dict = {command['clusterId']: [report]}
+      is_sent, correlation_id = self.force_update_to_server(report_dict)
 
-    if not is_sent or updatable:
-      self.queue_report_sending(key, command, report)
-    else:
-      self.server_responses_listener.listener_functions_on_error[correlation_id] = lambda headers, message: self.queue_report_sending(key, command, report)
+      self.server_responses_listener.listener_functions_on_success[correlation_id] = lambda headers, message: \
+        self.clear_reported_reports(report_dict)
 
   def queue_report_sending(self, key, command, report):
     with self.lock:


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@ambari.apache.org
For additional commands, e-mail: commits-help@ambari.apache.org