You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kudu.apache.org by to...@apache.org on 2017/11/03 00:27:32 UTC

[2/5] kudu git commit: scripts: better documentation for get-job-stats-from-mysql.py

scripts: better documentation for get-job-stats-from-mysql.py

The parameter named 'job_name' was (confusingly) substituted in as the
query's workload.

Change-Id: I3d26c783d66b9420d5ced50363c9421e7c1944bc
Reviewed-on: http://gerrit.cloudera.org:8080/8453
Tested-by: Kudu Jenkins
Reviewed-by: Todd Lipcon <to...@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/kudu/repo
Commit: http://git-wip-us.apache.org/repos/asf/kudu/commit/d8c39d24
Tree: http://git-wip-us.apache.org/repos/asf/kudu/tree/d8c39d24
Diff: http://git-wip-us.apache.org/repos/asf/kudu/diff/d8c39d24

Branch: refs/heads/master
Commit: d8c39d24b4d88786e7294b9c002c72219a946ca5
Parents: 3e86797
Author: Adar Dembo <ad...@cloudera.com>
Authored: Thu Nov 2 12:22:49 2017 -0700
Committer: Todd Lipcon <to...@apache.org>
Committed: Fri Nov 3 00:05:41 2017 +0000

----------------------------------------------------------------------
 src/kudu/scripts/get-job-stats-from-mysql.py | 22 +++++++++++++++++++---
 1 file changed, 19 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kudu/blob/d8c39d24/src/kudu/scripts/get-job-stats-from-mysql.py
----------------------------------------------------------------------
diff --git a/src/kudu/scripts/get-job-stats-from-mysql.py b/src/kudu/scripts/get-job-stats-from-mysql.py
index 5850a8a..5748886 100644
--- a/src/kudu/scripts/get-job-stats-from-mysql.py
+++ b/src/kudu/scripts/get-job-stats-from-mysql.py
@@ -16,13 +16,29 @@
 # KIND, either express or implied.  See the License for the
 # specific language governing permissions and limitations
 # under the License.
+#
+# Fetches the last N days worth of stats of a particular workload from the
+# MySQL database housing test performance stats.
+#
+# Here's the database schema for kudu_perf_tpch:
+#
+# +--------------+--------------+------+-----+-------------------+-------+
+# | Field        | Type         | Null | Key | Default           | Extra |
+# +--------------+--------------+------+-----+-------------------+-------+
+# | job_name     | varchar(50)  | YES  |     | NULL              |       |
+# | build_number | int(11)      | YES  |     | NULL              |       |
+# | workload     | varchar(100) | YES  |     | NULL              |       |
+# | iteration    | int(2)       | YES  |     | NULL              |       |
+# | runtime      | float        | YES  |     | NULL              |       |
+# | curr_date    | timestamp    | NO   |     | CURRENT_TIMESTAMP |       |
+# +--------------+--------------+------+-----+-------------------+-------+
 
 import MySQLdb as mdb
 import sys
 import os
 
 if len(sys.argv) < 3:
-  sys.exit("usage: %s <job_name> <days_count_to_fetch>" % sys.argv[0])
+  sys.exit("usage: %s <workload> <days_count_to_fetch>" % sys.argv[0])
 
 host = os.environ["MYSQLHOST"]
 user = os.environ["MYSQLUSER"]
@@ -32,9 +48,9 @@ db = os.environ["MYSQLDB"]
 con = mdb.connect(host, user, pwd, db)
 with con:
   cur = con.cursor()
-  job_name = sys.argv[1]
+  workload = sys.argv[1]
   days = sys.argv[2]
-  cur.execute("select workload, runtime, build_number from kudu_perf_tpch where workload like %s AND curr_date >= DATE_SUB(NOW(), INTERVAL %s DAY) and runtime != 0 ORDER BY workload, build_number, curr_date", (job_name, days))
+  cur.execute("select workload, runtime, build_number from kudu_perf_tpch where workload like %s AND curr_date >= DATE_SUB(NOW(), INTERVAL %s DAY) and runtime != 0 ORDER BY workload, build_number, curr_date", (workload, days))
   rows = cur.fetchall()
   print 'workload', '\t', 'runtime', '\t', 'build_number'
   for row in rows: