Repository: incubator-slider Updated Branches: refs/heads/feature/python_unittests 1425f76a0 -> 801825d0a
Test Commit 8 Project: http://git-wip-us.apache.org/repos/asf/incubator-slider/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-slider/commit/801825d0 Tree: http://git-wip-us.apache.org/repos/asf/incubator-slider/tree/801825d0 Diff: http://git-wip-us.apache.org/repos/asf/incubator-slider/diff/801825d0 Branch: refs/heads/feature/python_unittests Commit: 801825d0a976f4a0b7c341386f9fa438817a8966 Parents: 1425f76 Author: Sumit Mohanty <smoha...@hortonworks.com> Authored: Sun Nov 9 09:15:14 2014 -0800 Committer: Sumit Mohanty <smoha...@hortonworks.com> Committed: Sun Nov 9 09:15:14 2014 -0800 ---------------------------------------------------------------------- .../src/main/python/agent/PythonExecutor.py | 24 ++++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/801825d0/slider-agent/src/main/python/agent/PythonExecutor.py ---------------------------------------------------------------------- diff --git a/slider-agent/src/main/python/agent/PythonExecutor.py b/slider-agent/src/main/python/agent/PythonExecutor.py index 866755f..97e8b1f 100644 --- a/slider-agent/src/main/python/agent/PythonExecutor.py +++ b/slider-agent/src/main/python/agent/PythonExecutor.py @@ -101,18 +101,18 @@ class PythonExecutor: out = open(tmpoutfile, 'r').read() error = open(tmperrfile, 'r').read() - try: - with open(tmpstructedoutfile, 'r') as fp: - structured_out = json.load(fp) - except Exception: - if os.path.exists(tmpstructedoutfile): - errMsg = 'Unable to read structured output from ' + tmpstructedoutfile - structured_out = { - 'msg': errMsg - } - logger.warn(structured_out) - else: - structured_out = {} + structured_out = {} + if os.path.exists(tmpstructedoutfile): + try: + with open(tmpstructedoutfile, 'r') as fp: + structured_out = json.load(fp) + except Exception as e: + if os.path.exists(tmpstructedoutfile): + errMsg = 'Unable to read structured output from ' + tmpstructedoutfile + ' ' + str(e) + structured_out = { + 'msg': errMsg + } + logger.warn(structured_out) if self.python_process_has_been_killed: error = str(error) + "\n Python script has been killed due to timeout"