You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@impala.apache.org by bo...@apache.org on 2018/12/13 13:23:07 UTC
[5/5] impala git commit: Remove Python 2.4 workarounds in
start-impala-cluster.py
Remove Python 2.4 workarounds in start-impala-cluster.py
The workarounds are:
* Trying to handle the json module not being present. That module was
added in Python 2.6 and also isn't used in this file!
* Trying to handle import failure of ImpalaCluster. It's less clear why
this was necessary, but I can't see a reason why we wouldn't be able
to import our own code that is used in many places in the tests.
Neither seems necessary at this point.
Testing:
Ran a build on CentOS 6 with Python 2.4 and confirmed that
it was able to start the cluster OK.
Change-Id: Ia28a7b75f2e2804834e5df57ef7998b360112e5c
Reviewed-on: http://gerrit.cloudera.org:8080/12078
Reviewed-by: Impala Public Jenkins <im...@cloudera.com>
Tested-by: Impala Public Jenkins <im...@cloudera.com>
Project: http://git-wip-us.apache.org/repos/asf/impala/repo
Commit: http://git-wip-us.apache.org/repos/asf/impala/commit/cf5355bd
Tree: http://git-wip-us.apache.org/repos/asf/impala/tree/cf5355bd
Diff: http://git-wip-us.apache.org/repos/asf/impala/diff/cf5355bd
Branch: refs/heads/master
Commit: cf5355bd4051c937100eadc8eaadf77d829f18e2
Parents: c209fed
Author: Tim Armstrong <ta...@cloudera.com>
Authored: Wed Dec 12 11:44:54 2018 -0800
Committer: Impala Public Jenkins <im...@cloudera.com>
Committed: Thu Dec 13 06:52:46 2018 +0000
----------------------------------------------------------------------
bin/start-impala-cluster.py | 49 ++++++++--------------------------------
1 file changed, 9 insertions(+), 40 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/impala/blob/cf5355bd/bin/start-impala-cluster.py
----------------------------------------------------------------------
diff --git a/bin/start-impala-cluster.py b/bin/start-impala-cluster.py
index d052650..a4ff606 100755
--- a/bin/start-impala-cluster.py
+++ b/bin/start-impala-cluster.py
@@ -30,6 +30,7 @@ from time import sleep, time
from optparse import OptionParser, SUPPRESS_HELP
from testdata.common import cgroups
from tests.common.environ import build_flavor_timeout
+from tests.common.impala_cluster import ImpalaCluster
logging.basicConfig(level=logging.ERROR, format="%(asctime)s %(threadName)s: %(message)s",
datefmt="%H:%M:%S")
@@ -370,7 +371,8 @@ def wait_for_impala_process_count(impala_cluster, retries=10):
if msg:
raise RuntimeError(msg)
-def wait_for_cluster_web(timeout_in_seconds=CLUSTER_WAIT_TIMEOUT_IN_SECONDS):
+
+def wait_for_cluster(timeout_in_seconds=CLUSTER_WAIT_TIMEOUT_IN_SECONDS):
"""Checks if the cluster is "ready"
A cluster is deemed "ready" if:
@@ -423,20 +425,6 @@ def wait_for_catalog(impalad, timeout_in_seconds=CLUSTER_WAIT_TIMEOUT_IN_SECONDS
raise RuntimeError("Unable to open client ports within {num_seconds} seconds.".format(
num_seconds=timeout_in_seconds))
-def wait_for_cluster_cmdline(timeout_in_seconds=CLUSTER_WAIT_TIMEOUT_IN_SECONDS):
- """Checks if the cluster is "ready" by executing a simple query in a loop"""
- start_time = time()
- IMPALA_SHELL = os.path.join(IMPALA_HOME, "bin/impala-shell.sh")
- cmd = "{impala_shell} -i localhost:21000 -q '{query}'".format(
- impala_shell=IMPALA_SHELL,
- query="select 1")
- while os.system(cmd) != 0:
- if time() - timeout_in_seconds > start_time:
- raise RuntimeError("Cluster did not start within {num_seconds} seconds".format(
- num_seconds=timeout_in_seconds))
- LOG.info("Cluster not yet available. Sleeping...")
- sleep(2)
-
if __name__ == "__main__":
if options.kill_only:
kill_cluster_processes(force=options.force_kill)
@@ -488,31 +476,12 @@ if __name__ == "__main__":
else:
kill_cluster_processes(force=options.force_kill)
- try:
- import json
- wait_for_cluster = wait_for_cluster_web
- except ImportError:
- LOG.exception("json module not found, checking "
- "for cluster startup through the command-line")
- wait_for_cluster = wait_for_cluster_cmdline
-
- # If ImpalaCluster cannot be imported, fall back to the command-line to check
- # whether impalads/statestore are up.
- try:
- from tests.common.impala_cluster import ImpalaCluster
- if options.restart_impalad_only:
- impala_cluster = ImpalaCluster()
- if not impala_cluster.statestored or not impala_cluster.catalogd:
- LOG.info("No running statestored or catalogd detected. "
- "Restarting entire cluster.")
- options.restart_impalad_only = False
- except ImportError:
- LOG.exception("ImpalaCluster module not found.")
- # TODO: Update this code path to work similar to the ImpalaCluster code path when
- # restarting only impalad processes. Specifically, we should do a full cluster
- # restart if either the statestored or catalogd processes are down, even if
- # restart_only_impalad=True.
- wait_for_cluster = wait_for_cluster_cmdline
+ if options.restart_impalad_only:
+ impala_cluster = ImpalaCluster()
+ if not impala_cluster.statestored or not impala_cluster.catalogd:
+ LOG.info("No running statestored or catalogd detected. "
+ "Restarting entire cluster.")
+ options.restart_impalad_only = False
try:
if options.restart_catalogd_only: