summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAravindan Vijayan <avijayan@hortonworks.com>2018-07-09 15:40:07 -0700
committerIshan Bhatt <ishanbhatt.1989@gmail.com>2018-07-09 18:58:34 -0700
commitda4e607a48033ab1f359b3ace302fcf29d823e38 (patch)
tree00b8271ee0ce2e7b9ad2747df9fa0ca083793456
parent2be530f7a95542bd154b38e8917cfc9310d8d050 (diff)
Revert "AMBARI-24270. Agent Status Command Are Randomly Failing With Empty stderr (aonishuk) (#1728)"
This reverts commit 219a23623349bc3715f6c667369477bd32ef1b0b.
-rw-r--r--ambari-agent/src/main/python/ambari_agent/ComponentStatusExecutor.py2
-rw-r--r--ambari-agent/src/main/python/ambari_agent/CustomServiceOrchestrator.py14
-rw-r--r--ambari-agent/src/main/python/ambari_agent/PythonExecutor.py11
3 files changed, 3 insertions, 24 deletions
diff --git a/ambari-agent/src/main/python/ambari_agent/ComponentStatusExecutor.py b/ambari-agent/src/main/python/ambari_agent/ComponentStatusExecutor.py
index 65af9b06be..5d20495c0b 100644
--- a/ambari-agent/src/main/python/ambari_agent/ComponentStatusExecutor.py
+++ b/ambari-agent/src/main/python/ambari_agent/ComponentStatusExecutor.py
@@ -136,7 +136,7 @@ class ComponentStatusExecutor(threading.Thread):
if status == LiveStatus.DEAD_STATUS:
stderr = component_status_result['stderr']
if not "ComponentIsNotRunning" in stderr and not "ClientComponentHasNoStatus" in stderr:
- logger.info("Status command for {0} failed ({1}) :\n{2}".format(component_name, component_status_result, stderr))
+ logger.info("Status command for {0} failed:\n{1}".format(component_name, stderr))
result = {
'serviceName': service_name,
diff --git a/ambari-agent/src/main/python/ambari_agent/CustomServiceOrchestrator.py b/ambari-agent/src/main/python/ambari_agent/CustomServiceOrchestrator.py
index bcb3e9b8c2..51a0d59d68 100644
--- a/ambari-agent/src/main/python/ambari_agent/CustomServiceOrchestrator.py
+++ b/ambari-agent/src/main/python/ambari_agent/CustomServiceOrchestrator.py
@@ -326,7 +326,6 @@ class CustomServiceOrchestrator():
try:
command = self.generate_command(command_header)
- logger.info("Generated command")
script_type = command['commandParams']['script_type']
script = command['commandParams']['script']
timeout = int(command['commandParams']['command_timeout'])
@@ -340,8 +339,6 @@ class CustomServiceOrchestrator():
command_name = command['roleCommand']
else:
task_id = 'status'
-
- logger.info("[{0}]".format(task_id))
if forced_command_name is not None: # If not supplied as an argument
command_name = forced_command_name
@@ -425,18 +422,11 @@ class CustomServiceOrchestrator():
if log_out_files:
script_params.append("-o")
- logger.info("[{0}] python_executor.run_file({1})".format(task_id, (py_file, script_params,
- tmpoutfile, tmperrfile, timeout,
- tmpstrucoutfile, self.map_task_to_process,
- task_id, override_output_files, backup_log_files,
- handle, log_info_on_failure)))
-
ret = python_executor.run_file(py_file, script_params,
tmpoutfile, tmperrfile, timeout,
tmpstrucoutfile, self.map_task_to_process,
task_id, override_output_files, backup_log_files = backup_log_files,
handle = handle, log_info_on_failure=log_info_on_failure)
- logger.info("[{0}] python_executor.run_file() returned {1}", task_id, ret)
# Next run_file() invocations should always append to current output
override_output_files = False
if ret['exitcode'] != 0:
@@ -447,7 +437,6 @@ class CustomServiceOrchestrator():
# if canceled and not background command
if handle is None:
- logger.info("[{0}] canceled", task_id)
cancel_reason = self.command_canceled_reason(task_id)
if cancel_reason is not None:
ret['stdout'] += cancel_reason
@@ -523,7 +512,6 @@ class CustomServiceOrchestrator():
Exit code 0 means that component is running and any other exit code means that
component is not running
"""
- logger.info("Requesting component status {0}".format(command_header))
override_output_files=True # by default, we override status command output
if logger.level == logging.DEBUG:
override_output_files = False
@@ -531,8 +519,6 @@ class CustomServiceOrchestrator():
res = self.runCommand(command_header, self.status_commands_stdout,
self.status_commands_stderr, self.COMMAND_NAME_STATUS,
override_output_files=override_output_files, is_status_command=True)
-
- logger.info("requestComponentStatus return={0}".format(res))
return res
def resolve_script_path(self, base_dir, script):
diff --git a/ambari-agent/src/main/python/ambari_agent/PythonExecutor.py b/ambari-agent/src/main/python/ambari_agent/PythonExecutor.py
index bfbbc17df1..8b9e9ca26b 100644
--- a/ambari-agent/src/main/python/ambari_agent/PythonExecutor.py
+++ b/ambari-agent/src/main/python/ambari_agent/PythonExecutor.py
@@ -44,7 +44,6 @@ class PythonExecutor(object):
used as a singleton for a concurrent execution of python scripts
"""
NO_ERROR = "none"
- i = 0
def __init__(self, tmpDir, config):
self.grep = Grep()
@@ -94,16 +93,14 @@ class PythonExecutor(object):
recreated or appended.
The structured out file, however, is preserved during multiple invocations that use the same file.
"""
- PythonExecutor.i += 1
-
pythonCommand = self.python_command(script, script_params)
- logger.info("[%d] Running command %s", PythonExecutor.i, pprint.pformat(pythonCommand))
+ if logger.isEnabledFor(logging.DEBUG):
+ logger.debug("Running command %s", pprint.pformat(pythonCommand))
if handle is None:
tmpout, tmperr = self.open_subprocess32_files(tmpoutfile, tmperrfile, override_output_files, backup_log_files)
process = self.launch_python_subprocess32(pythonCommand, tmpout, tmperr)
- logger.info("[%d] Started process with pid = %s", PythonExecutor.i, process.pid)
# map task_id to pid
callback(task_id, process.pid)
logger.debug("Launching watchdog thread")
@@ -113,7 +110,6 @@ class PythonExecutor(object):
thread.start()
# Waiting for the process to be either finished or killed
process.communicate()
- logger.info("[{0}] Process communicated {1}", PythonExecutor.i, (process.returncode, tmpoutfile, tmperrfile, tmpstructedoutfile, timeout))
self.event.set()
thread.join()
result = self.prepare_process_result(process.returncode, tmpoutfile, tmperrfile, tmpstructedoutfile, timeout=timeout)
@@ -121,10 +117,8 @@ class PythonExecutor(object):
if log_info_on_failure and result['exitcode']:
self.on_failure(pythonCommand, result)
- logger.info("[{0}] PE.run_file() returned {1}", PythonExecutor.i, result)
return result
else:
- logger.info("[{0}] has handle", PythonExecutor.i)
holder = Holder(pythonCommand, tmpoutfile, tmperrfile, tmpstructedoutfile, handle)
background = BackgroundThread(holder, self)
@@ -182,7 +176,6 @@ class PythonExecutor(object):
for k, v in command_env.iteritems():
command_env[k] = str(v)
- logger.info("[{0}] launch_python_subprocess32 {1}".format(PythonExecutor.i, (command, tmpout, tmperr, close_fds, self.preexec_fn)))
return subprocess32.Popen(command,
stdout=tmpout,
stderr=tmperr, close_fds=close_fds, env=command_env, preexec_fn=self.preexec_fn)