This is an automated email from the ASF dual-hosted git repository. aonishuk 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 11ea165 AMBARI-24270. Agent Status Command Are Randomly Failing With Empty stderr (aonishuk) 11ea165 is described below commit 11ea165b7c6d8da5462011fff10b6420b4f410c1 Author: Andrew Onishuk <aonis...@hortonworks.com> AuthorDate: Wed Jul 11 10:07:05 2018 +0300 AMBARI-24270. Agent Status Command Are Randomly Failing With Empty stderr (aonishuk) --- .../main/python/ambari_agent/CustomServiceOrchestrator.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/ambari-agent/src/main/python/ambari_agent/CustomServiceOrchestrator.py b/ambari-agent/src/main/python/ambari_agent/CustomServiceOrchestrator.py index 9c1fb3e..32c4094 100644 --- a/ambari-agent/src/main/python/ambari_agent/CustomServiceOrchestrator.py +++ b/ambari-agent/src/main/python/ambari_agent/CustomServiceOrchestrator.py @@ -456,7 +456,13 @@ class CustomServiceOrchestrator(): if incremented_commands_for_component: self.commands_for_component_in_progress[cluster_id][command['role']] -= 1 - self.conditionally_remove_command_file(json_path, ret) + if is_status_command and json_path: + try: + os.unlink(json_path) + except OSError: + pass # Ignore failure + else: + self.conditionally_remove_command_file(json_path, ret) return ret @@ -562,9 +568,8 @@ class CustomServiceOrchestrator(): command_type = command['commandType'] from ActionQueue import ActionQueue # To avoid cyclic dependency if command_type == ActionQueue.STATUS_COMMAND: - # These files are frequently created, that's why we don't - # store them all, but only the latest one - file_path = os.path.join(self.tmp_dir, "status_command.json") + timestamp = time.time() + file_path = os.path.join(self.tmp_dir, "status_command_{0}.json".format(timestamp)) else: task_id = command['taskId'] file_path = os.path.join(self.tmp_dir, "command-{0}.json".format(task_id))