Repository: incubator-impala
Updated Branches:
  refs/heads/master 3dccb0125 -> cd2ee9ecf


IMPALA-3800: Python 2.6 support for collect_minidumps.py

Python 2.6 is the default python version shipped with CentOS 6.6 and
the minidump collection script needs to run there, too. However, the
tarfile library version shipped with python 2.6 does not support using
TarFile objects as context managers. This change wraps the usage of
tarfile.TarFile in contextlib.closing to support python 2.6, too.

Testing: I verified that this script runs with python 2.7 on testdata
generated using the generate_minidump_collection_testdata.py script. I
also copied an updated version to a CentOS 6.6 cluster and verified that
the problem is resolved there.

Change-Id: Ic9028626fa829ff7571d2a731c2fcd7e15e2ce36
Reviewed-on: http://gerrit.cloudera.org:8080/3525
Reviewed-by: Michael Brown <[email protected]>
Reviewed-by: Taras Bobrovytsky <[email protected]>
Reviewed-by: Dan Hecht <[email protected]>
Tested-by: Lars Volker <[email protected]>


Project: http://git-wip-us.apache.org/repos/asf/incubator-impala/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-impala/commit/7b9e9c63
Tree: http://git-wip-us.apache.org/repos/asf/incubator-impala/tree/7b9e9c63
Diff: http://git-wip-us.apache.org/repos/asf/incubator-impala/diff/7b9e9c63

Branch: refs/heads/master
Commit: 7b9e9c634912c312e7e114fc5d983ffddf0b399f
Parents: 5f3dfdf
Author: Lars Volker <[email protected]>
Authored: Tue Jun 28 23:06:19 2016 +0200
Committer: Tim Armstrong <[email protected]>
Committed: Tue Jul 5 13:37:25 2016 -0700

----------------------------------------------------------------------
 bin/collect_minidumps.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/7b9e9c63/bin/collect_minidumps.py
----------------------------------------------------------------------
diff --git a/bin/collect_minidumps.py b/bin/collect_minidumps.py
index c78e5cb..4f03c61 100755
--- a/bin/collect_minidumps.py
+++ b/bin/collect_minidumps.py
@@ -25,6 +25,7 @@ import re
 import sys
 import tarfile
 
+from contextlib import closing
 from optparse import OptionParser
 
 class FileArchiver(object):
@@ -67,7 +68,7 @@ class FileArchiver(object):
     if num_files == 0:
       size = 0
     else:
-      with tarfile.open(self.output_file_path, mode='w:gz') as out:
+      with closing(tarfile.open(self.output_file_path, mode='w:gz')) as out:
         for i in xrange(num_files):
           out.add(self.file_list[i])
       size = os.stat(self.output_file_path).st_size

Reply via email to