This is an automated email from the ASF dual-hosted git repository. michaelsmith pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/impala.git
commit df2e03ce0bc54cfd142c39a4e48f8b555248c969 Author: Michael Smith <[email protected]> AuthorDate: Fri Apr 14 09:49:33 2023 -0700 IMPALA-11974: Fix xrange, split in collect_diagnostics.py Python3 deprecates xrange operator, this commit replaces it with the range operator similar to earlier replacements in IMPALA-11974. Adds universal_newlines to Popen so that we return text in Python 3. Testing: - Ran '$IMPALA_HOME/bin/diagnostics/collect_diagnostics.py --pid <pid> --minidumps 2 1 --minidumps_dir $IMPALA_HOME/logs/cluster/minidumps --stacks 2 1' with Python 2/3 and inspected the results. Change-Id: I52f075825d47613293b106a7c50d4499c19cd3f4 Reviewed-on: http://gerrit.cloudera.org:8080/19746 Reviewed-by: Impala Public Jenkins <[email protected]> Tested-by: Impala Public Jenkins <[email protected]> --- bin/diagnostics/collect_diagnostics.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/bin/diagnostics/collect_diagnostics.py b/bin/diagnostics/collect_diagnostics.py index f4b3298c4..a305a0d0a 100755 --- a/bin/diagnostics/collect_diagnostics.py +++ b/bin/diagnostics/collect_diagnostics.py @@ -87,7 +87,8 @@ class Command(object): cmd_string = " ".join(self.cmd) logging.info("Starting command %s with a timeout of %s" % (cmd_string, str(self.timeout))) - self.child = subprocess.Popen(self.cmd, stdin=cmd_stdin, stdout=cmd_stdout) + self.child = subprocess.Popen(self.cmd, stdin=cmd_stdin, stdout=cmd_stdout, + universal_newlines=True) timer = Timer(self.timeout, self.kill_child) try: timer.start() @@ -312,7 +313,7 @@ class ImpalaDiagnosticsHandler(object): cmds_to_run.append((Command(cmd_args, self.args.timeout), "pstack", False)) collection_start_ts = time.time() - for i in xrange(stacks_count): + for i in range(stacks_count): for cmd, file_prefix, is_minidump in cmds_to_run: if file_prefix: stdout_file = os.path.join(stacks_dir, file_prefix + "-" + str(i) + ".txt") @@ -341,7 +342,7 @@ class ImpalaDiagnosticsHandler(object): cmd_args = ["kill", "-SIGUSR1", str(self.args.pid)] cmd = Command(cmd_args, self.args.timeout) collection_start_ts = time.time() - for i in xrange(minidump_count): + for i in range(minidump_count): cmd.run() self.wait_for_minidump() time.sleep(minidump_interval_secs)
