aboutsummaryrefslogtreecommitdiff
path: root/cli
diff options
context:
space:
mode:
authorAllen Li <ayatane@chromium.org>2020-01-15 14:36:08 -0800
committerCommit Bot <commit-bot@chromium.org>2020-03-10 01:15:04 +0000
commit3aa51ba8341cb07ebf5b4af4c9f473e851f378e5 (patch)
tree7e33353ecd5d8d0586f77ea9352c4ed2e0f19542 /cli
parent45e427ed39ae46a712cfa63a2961bce1e8c854c1 (diff)
downloadautotest-3aa51ba8341cb07ebf5b4af4c9f473e851f378e5.tar.gz
autotest: Delete query scripts
This file was untouched for 11 years. I think it was replaced by the TKO composes_query.cgi view. No grep hits otherwise. Bug: 1033823 Change-Id: I83ee13ac98bd60895ef75d93ebf8680bdb56584c Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/autotest/+/2024171 Tested-by: Allen Li <ayatane@chromium.org> Commit-Queue: Allen Li <ayatane@chromium.org> Reviewed-by: Mike Frysinger <vapier@chromium.org>
Diffstat (limited to 'cli')
-rwxr-xr-xcli/compose_query51
-rwxr-xr-xcli/query_keyvals75
-rwxr-xr-xcli/query_results106
3 files changed, 0 insertions, 232 deletions
diff --git a/cli/compose_query b/cli/compose_query
deleted file mode 100755
index 8d46a5b55d..0000000000
--- a/cli/compose_query
+++ /dev/null
@@ -1,51 +0,0 @@
-#!/usr/bin/python2
-"""
-Selects all rows and columns that satisfy the condition specified
-and prints the matrix.
-"""
-import sys, os, re, optparse
-import common
-from autotest_lib.client.common_lib import kernel_versions
-from autotest_lib.tko import display, frontend, db, query_lib
-
-# First do all the options parsing
-parser = optparse.OptionParser()
-parser.add_option('-x', '--x_axis', action='store', dest='x_axis',
- default='machine_group')
-parser.add_option('-y', '--y_axis', action='store', dest='y_axis',
- default='kernel')
-parser.add_option('-c', '--condition', action='store', dest='condition')
-(options, args) = parser.parse_args()
-
-if options.condition:
- where = query_lib.parse_scrub_and_gen_condition(
- options.condition, frontend.test_view_field_dict)
- # print("where clause:" % where)
-else:
- where = None
-
-# Grab the data
-db = db.db()
-test_data = frontend.get_matrix_data(db, options.x_axis, options.y_axis, where)
-
-# Print everything
-widest_row_header = max([len(y) for y in test_data.y_values])
-data_column_width = max([max(13,len(x)) for x in test_data.x_values])
-column_widths = [widest_row_header] + [data_column_width] * len(test_data.x_values)
-format = ' | '.join(['%%%ds' % i for i in column_widths])
-# Print headers
-print format % tuple([''] + test_data.x_values)
-
-# print data
-for y in test_data.y_values:
- line = [y]
- for x in test_data.x_values:
- try:
- data_point = test_data.data[x][y]
- good_status = db.status_idx['GOOD']
- good = data_point.status_count.get(good_status, 0)
- total = sum(data_point.status_count.values())
- line.append('%5d / %-5d' % (good, total))
- except:
- line.append('')
- print format % tuple(line)
diff --git a/cli/query_keyvals b/cli/query_keyvals
deleted file mode 100755
index 319119e712..0000000000
--- a/cli/query_keyvals
+++ /dev/null
@@ -1,75 +0,0 @@
-#!/usr/bin/python2
-
-import sys, optparse
-import common
-from autotest_lib.cli import rpc
-
-
-def parse_options():
- usage = "usage: %prog [options] job_id"
- parser = optparse.OptionParser(usage=usage)
- parser.add_option("-m", "--machine", dest="machine")
- parser.add_option("-t", "--test", dest="test")
- parser.add_option("-T", "--type", dest="type", type="choice",
- choices=["all", "test", "iteration", "attr", "perf"])
- parser.add_option("-k", "--key", dest="key")
- parser.set_defaults(type="all")
- options, args = parser.parse_args()
- options.show_test_keyvals = options.type in ("all", "test")
- options.show_attr_keyvals = options.type in ("all", "iteration", "attr")
- options.show_perf_keyvals = options.type in ("all", "iteration", "perf")
- options.show_iter_keyvals = (
- options.show_perf_keyvals or options.show_attr_keyvals)
- return parser, options, args
-
-
-def print_keyvals(keyval, format_string, options):
- for key, value in keyval.iteritems():
- if not options.key or key == options.key:
- print format_string % (key, value)
-
-
-def print_views(test_views, options):
- for view in test_views:
- if not options.machine:
- print "Machine: %s" % view["hostname"]
- if not options.test:
- print "Test: %s" % view["test_name"]
- if options.show_test_keyvals:
- print "Test Attributes:"
- print_keyvals(view["attributes"], "\t%s = %s", options)
- if options.show_iter_keyvals:
- print "Iteration Attributes:"
- for i, iteration in enumerate(view["iterations"]):
- print "\tIteration #%d:" % (i + 1)
- if options.show_attr_keyvals:
- print_keyvals(iteration["attr"], "\t\t%s(attr) = %s",
- options)
- if options.show_perf_keyvals:
- print_keyvals(iteration["perf"], "\t\t%s(perf) = %s",
- options)
- print
-
-
-def main():
- parser, options, args = parse_options()
- if not args:
- parser.print_help()
- return
-
- query_filter = {}
- if options.machine:
- query_filter["hostname"] = options.machine
- if options.test:
- query_filter["test_name"] = options.test
-
- comm = rpc.tko_comm()
- test_views = []
- for job_id in args:
- query_filter["job_tag__startswith"] = "%s-" % job_id
- test_views += comm.run("get_detailed_test_views", **query_filter)
- print_views(test_views, options)
-
-
-if __name__ == "__main__":
- main()
diff --git a/cli/query_results b/cli/query_results
deleted file mode 100755
index aaac2565f9..0000000000
--- a/cli/query_results
+++ /dev/null
@@ -1,106 +0,0 @@
-#!/usr/bin/python2
-"""
-Selects all rows and columns that satisfy the condition specified
-and prints the matrix.
-"""
-import optparse
-import common
-from autotest_lib.cli import rpc
-from autotest_lib.database import database_connection
-
-
-# First do all the options parsing
-parser = optparse.OptionParser()
-parser.add_option(
- '-C', '--columns', action='store', dest='columns',
- default='test_name,reason,test_started_time,test_finished_time,job_tag,'
- 'job_name,hostname,platform,kernel,status',
- help='Comma-separated list of column names to display')
-parser.add_option('-w', '--where', action='store', dest='condition',
- help=("The WHERE condition for the query witten in the 'new style' "
- "condition syntax for new tko (see "
- "http://autotest.kernel.org/wiki/TkoHowTo for more info)"))
-parser.add_option(
- '--test-attribute-field', action='append', default=[],
- help='Specifies a test attribute to include as a field. The attribute '
- 'value will be available as a field named attribute_<attribute '
- 'name>. This option may be specified multiple times. Filtering '
- 'must be done slightly differently -- see '
- 'http://autotest.kernel.org/wiki/TkoHowTo#attribute_filtering '
- 'for more details.')
-parser.add_option('--test-label-field', action='append', default=[],
- help='Specifies a test label to include as a field. See '
- '--attribute-field for more details')
-parser.add_option('--iteration-result-field', action='append', default=[],
- help='Specifies an iteration result to include as a field. '
- 'See --attribute-field for more details. Note that '
- 'this causes the rows returned to represent iterations '
- 'rather than plain test results.')
-parser.add_option('--machine-label-field', action='append', default=[],
- help='Specifies a machine label to include as a field. See '
- '--attribute-field for more details')
-parser.add_option('--job-keyval-field', action='append', default=[],
- help='Specifies a job keyval to include as a field. See '
- '--attribute-field for more details')
-parser.add_option('--iteration-attribute-field', action='append', default=[],
- help='Specifies an iteration attribute to include as a '
- 'field. See --attribute-field for more details. Note '
- 'that this causes the rows returned to represent '
- 'iterations rather than plain test results.')
-parser.add_option('-s', '--separator', action='store', default = ' | ',
- dest='separator', help = 'output separator')
-parser.add_option('-n', '--nocount', action='store_true', default=False,
- help='Do not display line counts before each line')
-parser.add_option('-l', '--logpath', action='store_true', default=False,
- help='Reformats the the tag column into a URL \
- like http://autotest/results/[tag]. \
- This will append the tag column if it isn\'t provided.')
-parser.add_option('--host-label', action='store', dest='host_label',
- help=('Return results only for machines currently '
- 'in the specified label'))
-
-(options, args) = parser.parse_args()
-
-if not options.condition:
- parser.error('You must specify a condition.')
-
-where = options.condition.replace('%', '%%')
-tag = 'job_tag'
-
-columns = options.columns.split(',')
-
-url_prefix = rpc.get_autotest_server() + '/results/'
-if options.logpath:
- if tag not in columns:
- columns.append(tag)
- tag_index=columns.index(tag)
-
-if options.host_label:
- database = database_connection.DatabaseConnection("AUTOTEST_WEB")
- database.connect()
- sql = ("SELECT hostname FROM afe_labels JOIN afe_hosts_labels "
- "ON afe_labels.id=afe_hosts_labels.label_id JOIN afe_hosts "
- "ON afe_hosts_labels.host_id=afe_hosts.id WHERE name=%s")
- results = database.execute(sql, options.host_label)
- hosts = [row[0] for row in results]
- where += " AND hostname IN ('" + "','".join(hosts) + "')"
-
-# Grab the data
-tko = rpc.tko_comm()
-count = 0
-test_views = tko.run(
- 'get_test_views', extra_where=where,
- test_attribute_fields=options.test_attribute_field,
- test_label_fields=options.test_label_field,
- iteration_result_fields=options.iteration_result_field,
- machine_label_fields=options.machine_label_field,
- job_keyval_fields=options.job_keyval_field,
- iteration_attribute_fields=options.iteration_attribute_field)
-for test_view in test_views:
- values = [str(test_view[column]) for column in columns]
- if options.logpath:
- values[tag_index] = url_prefix + values[tag_index]
- if not options.nocount:
- print '[%d] ' % count,
- count += 1
- print options.separator.join(values)