ambari-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andrew Onischuk (JIRA)" <j...@apache.org>
Subject [jira] [Created] (AMBARI-18162) Tracebacks of exceptions should always be available
Date Tue, 16 Aug 2016 14:50:20 GMT
Andrew Onischuk created AMBARI-18162:
----------------------------------------

             Summary: Tracebacks of exceptions should always be available
                 Key: AMBARI-18162
                 URL: https://issues.apache.org/jira/browse/AMBARI-18162
             Project: Ambari
          Issue Type: Bug
            Reporter: Andrew Onischuk
            Assignee: Andrew Onischuk
             Fix For: 3.0.0
         Attachments: AMBARI-18162.patch

We have a bunch of places similar to this (especially in python RU code):

    
    
    
      try:
        dfsadmin_base_command = get_dfsadmin_base_command(hdfs_binary)
        command = dfsadmin_base_command + ' -report -live'
        return_code, hdfs_output = shell.call(command, user=params.hdfs_user)
      except:
        raise Fail('Unable to determine if the DataNode has started after upgrade.')
    

Where the actual valuable information is just masked by re-raising exception
and saying "something went wrong sorry". This makes issues very problematic to
debug, especially on other users side, where it's often hard to receive any
information.

The solution would be to make Fail exception class to print the causing
exception. Similar to what is done by default in Python3.

Example:

    
    
    Traceback (most recent call last):
      File "/var/lib/ambari-agent/cache/common-services/YARN/2.1.0.2.0/package/scripts/service_check.py",
line 150, in service_check
        Execute("hive mkdir /a")
      File "/usr/lib/python2.6/site-packages/resource_management/core/base.py", line 155,
in __init__
        self.env.run()
      File "/usr/lib/python2.6/site-packages/resource_management/core/environment.py", line
160, in run
        self.run_action(resource, action)
      File "/usr/lib/python2.6/site-packages/resource_management/core/environment.py", line
124, in run_action
        provider_action()
      File "/usr/lib/python2.6/site-packages/resource_management/core/providers/system.py",
line 273, in action_run
        tries=self.resource.tries, try_sleep=self.resource.try_sleep)
      File "/usr/lib/python2.6/site-packages/resource_management/core/shell.py", line 71,
in inner
        result = function(command, **kwargs)
      File "/usr/lib/python2.6/site-packages/resource_management/core/shell.py", line 93,
in checked_call
        tries=tries, try_sleep=try_sleep)
      File "/usr/lib/python2.6/site-packages/resource_management/core/shell.py", line 141,
in _call_wrapper
        result = _call(command, **kwargs_copy)
      File "/usr/lib/python2.6/site-packages/resource_management/core/shell.py", line 294,
in _call
        raise Fail(err_msg)
    Fail: Execution of 'hive mkdir /a' returned 127. /bin/bash: hive: command not found
    
    The above exception was the direct cause of the following exception:
    
    Traceback (most recent call last):
      File "/var/lib/ambari-agent/cache/common-services/YARN/2.1.0.2.0/package/scripts/service_check.py",
line 164, in <module>
        ServiceCheck().execute()
      File "/usr/lib/python2.6/site-packages/resource_management/libraries/script/script.py",
line 280, in execute
        method(env)
      File "/var/lib/ambari-agent/cache/common-services/YARN/2.1.0.2.0/package/scripts/service_check.py",
line 152, in service_check
        raise Fail(format("Something went wrong"))
    resource_management.core.exceptions.Fail: Something went wrong
    





--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message