Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AMBARI-25589: When hearbeat is lost sometimes start/stop tasks can hang for a long time #3539

Merged
merged 1 commit into from Nov 21, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
20 changes: 9 additions & 11 deletions ambari-agent/src/main/python/ambari_agent/CommandStatusDict.py
Expand Up @@ -68,19 +68,17 @@ def put_command_status(self, command, report):
"""
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:
Expand Down