IMPALA-8199: Fix stress test: 'No module named RuntimeProfile.ttypes'

A recent commit (IMPALA-6964) broke the stress test because it added
an import of a generated thrift value to a python file that is
included by the stress test. The stress test is intended to be able to
be run without doing a full build of Impala, but in this case the
generated thrift isn't available, leading to an import error.

The solution is to only import the thrift value in the function where
it is used, which is not called by the stress test.

Testing:
- Ran the stress test manually without doing a full build and
  confirmed that it works now.

Change-Id: I7a3bd26d743ef6603fabf92f904feb4677001da5
Reviewed-on: http://gerrit.cloudera.org:8080/12472
Reviewed-by: Thomas Marshall <thomasmarshall@cmu.edu>
Tested-by: Impala Public Jenkins <impala-public-jenkins@cloudera.com>
This commit is contained in:
Thomas Tauber-Marshall
2019-02-12 21:15:09 -08:00
committed by Impala Public Jenkins
parent 6a8bc7f742
commit f0a47ab2ca

View File

@@ -17,7 +17,6 @@
import re import re
from datetime import datetime from datetime import datetime
from RuntimeProfile.ttypes import TSummaryStatsCounter
# IMPALA-6715: Every so often the stress test or the TPC workload directories get # IMPALA-6715: Every so often the stress test or the TPC workload directories get
# changed, and the stress test loses the ability to run the full set of queries. Set # changed, and the stress test loses the ability to run the full set of queries. Set
@@ -148,6 +147,9 @@ def get_bytes_summary_stats_counter(counter_name, runtime_profile):
summary_stats[0].max_value == 8192 and \ summary_stats[0].max_value == 8192 and \
summary_stats[0].total_num_values == 1 summary_stats[0].total_num_values == 1
""" """
# This requires the Thrift definitions to be generated. We limit the scope of the import
# to allow tools like the stress test to import this file without building Impala.
from RuntimeProfile.ttypes import TSummaryStatsCounter
regex_summary_stat = re.compile(r"""\( regex_summary_stat = re.compile(r"""\(
Avg:[^\(]*\((?P<avg>[0-9]+)\)\s;\s # Matches Avg: [?].[?] [?]B (?) Avg:[^\(]*\((?P<avg>[0-9]+)\)\s;\s # Matches Avg: [?].[?] [?]B (?)