This is an automated email from the ASF dual-hosted git repository.
granthenke pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/kudu.git
The following commit(s) were added to refs/heads/master by this push:
new 773bfe3 [python] Use positional formatting in Python scripts
773bfe3 is described below
commit 773bfe39f778f659871c987bdb4dc93eeef96408
Author: Grant Henke <[email protected]>
AuthorDate: Tue Jan 21 09:12:28 2020 -0600
[python] Use positional formatting in Python scripts
get-job-stats-from-mysql.py is not compatible with Python 2.6.x
beause it uses the format function without the positions included.
I also updated other calls to format without explicit positions.
Change-Id: I0eb17a5b0435e8e78a31124c8d9f3756583cd05a
Reviewed-on: http://gerrit.cloudera.org:8080/15075
Tested-by: Kudu Jenkins
Reviewed-by: Andrew Wong <[email protected]>
Reviewed-by: Bankim Bhavsar <[email protected]>
---
build-support/iwyu/iwyu_tool.py | 2 +-
src/kudu/experiments/merge-test.py | 8 ++++----
src/kudu/scripts/get-job-stats-from-mysql.py | 2 +-
src/kudu/scripts/graph-metrics.py | 2 +-
src/kudu/scripts/max_skew_estimate.py | 2 +-
5 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/build-support/iwyu/iwyu_tool.py b/build-support/iwyu/iwyu_tool.py
index 5ef38b9..7d74900 100755
--- a/build-support/iwyu/iwyu_tool.py
+++ b/build-support/iwyu/iwyu_tool.py
@@ -168,7 +168,7 @@ def run_iwyu(cwd, compile_command, iwyu_args, verbose):
cmd_args = ['include-what-you-use'] + clang_args + extra_args +
args.split()
if verbose:
- print('{}'.format(cmd_args))
+ print('{0}'.format(cmd_args))
return get_output(cwd, cmd_args)
diff --git a/src/kudu/experiments/merge-test.py
b/src/kudu/experiments/merge-test.py
index 419301c..6bb7cf0 100755
--- a/src/kudu/experiments/merge-test.py
+++ b/src/kudu/experiments/merge-test.py
@@ -457,7 +457,7 @@ class TestMerges(unittest.TestCase):
assert list_of_files
iters = [PagingBlockIterator(FileBlockIterator(f, stats),
stats) for f in list_of_files]
- logging.info("Starting merge with {}".format(merge_type.__name__))
+ logging.info("Starting merge with {0}".format(merge_type.__name__))
merge_iter = merge_type(iters)
logging.info("Initialized iterator")
results = []
@@ -471,16 +471,16 @@ class TestMerges(unittest.TestCase):
t2 = time.time()
if t2 - t1 > 10:
- logging.info("Merged {} elements ({} eps) {}".format(
+ logging.info("Merged {0} elements ({1} eps) {2}".format(
num_results,
num_results / (t2 - start),
repr(stats)))
t1 = t2
elapsed = time.time() - start
- logging.info("Merged {} elements".format(num_results))
+ logging.info("Merged {0} elements".format(num_results))
if expected_results:
self.assertEqual(expected_results, results)
- logging.info("{} with {} input: {}s {}".format(
+ logging.info("{0} with {1} input: {2}s {3}".format(
merge_type.__name__,
pattern,
elapsed,
diff --git a/src/kudu/scripts/get-job-stats-from-mysql.py
b/src/kudu/scripts/get-job-stats-from-mysql.py
index a7b52e2..d0d2bfa 100644
--- a/src/kudu/scripts/get-job-stats-from-mysql.py
+++ b/src/kudu/scripts/get-job-stats-from-mysql.py
@@ -54,4 +54,4 @@ with con:
rows = cur.fetchall()
print('workload \truntime \tbuild_number')
for row in rows:
- print("{} \t{} \t{}".format(row[0], row[1], row[2]))
+ print("{0} \t{1} \t{2}".format(row[0], row[1], row[2]))
diff --git a/src/kudu/scripts/graph-metrics.py
b/src/kudu/scripts/graph-metrics.py
index 35d606f..cd873fa 100755
--- a/src/kudu/scripts/graph-metrics.py
+++ b/src/kudu/scripts/graph-metrics.py
@@ -45,7 +45,7 @@ def parse_data_from(stream, scope):
try:
data_points = simplejson.loads(json)
except:
- print >>sys.stderr, "bad json:", json
+ print("bad json: " + json, file=sys.stderr)
raise
if data_points['scope'] != scope:
continue
diff --git a/src/kudu/scripts/max_skew_estimate.py
b/src/kudu/scripts/max_skew_estimate.py
index 9dd4732..d3574d3 100755
--- a/src/kudu/scripts/max_skew_estimate.py
+++ b/src/kudu/scripts/max_skew_estimate.py
@@ -84,7 +84,7 @@ def main():
skews = [generate_max_skew(num_servers, num_tablets, rf) for _ in
xrange(num_trials)]
skews.sort()
for p in [5, 25, 50, 75, 99]:
- print("{:02d} percentile: {:d}".format(p, percentile(skews, p)))
+ print("{0:02d} percentile: {1:d}".format(p, percentile(skews, p)))
if __name__ == "__main__":
main()