Skip to content

Commit 00798d9

Browse files
author
Pavel Kosov
committed
[LNT] Added the ability to disable regressions processing to improve performance
The regresssion processing can be disabled on the server side or per submit. Supported the option ignore_regressions = True in lnt.cfg to disable regresssion processing at all. Added the parameter --ignore-regressions to lnt submit command. Reviewed By: thopre, cmatthews Differential Revision: https://reviews.llvm.org/D111389
1 parent b4db710 commit 00798d9

File tree

6 files changed

+44
-19
lines changed

6 files changed

+44
-19
lines changed

lnt/lnttool/main.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,10 @@ def action_showtests():
186186
help="show verbose test results")
187187
@click.option("--testsuite", "-s", default='nts', show_default=True,
188188
help="testsuite to use in case the url is a file path")
189-
def action_submit(url, files, select_machine, merge, verbose, testsuite):
189+
@click.option("--ignore-regressions", is_flag=True,
190+
help="disable regression tracking")
191+
def action_submit(url, files, select_machine, merge, verbose,
192+
ignore_regressions):
190193
"""submit a test report to the server"""
191194
from lnt.util import ServerUtil
192195
import lnt.util.ImportData
@@ -197,7 +200,8 @@ def action_submit(url, files, select_machine, merge, verbose, testsuite):
197200

198201
results = ServerUtil.submitFiles(url, files, verbose,
199202
select_machine=select_machine,
200-
merge_run=merge, testsuite=testsuite)
203+
merge_run=merge, testsuite=testsuite,
204+
ignore_regressions=ignore_regressions)
201205
for submitted_file in results:
202206
if verbose:
203207
lnt.util.ImportData.print_report_result(

lnt/server/config.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,14 +118,16 @@ def from_data(path, data):
118118
blacklist = None
119119
secretKey = data.get('secret_key', None)
120120

121+
ignore_regressions = data.get('ignore_regressions', False)
122+
121123
return Config(data.get('name', 'LNT'), data['zorgURL'],
122124
dbDir, os.path.join(baseDir, tempDir),
123125
os.path.join(baseDir, profileDir), secretKey,
124126
dict([(k, DBInfo.from_data(dbDirPath, v,
125127
default_email_config,
126128
0))
127129
for k, v in data['databases'].items()]),
128-
blacklist, schemasDir, api_auth_token)
130+
blacklist, schemasDir, api_auth_token, ignore_regressions)
129131

130132
@staticmethod
131133
def dummy_instance():
@@ -159,7 +161,8 @@ def __init__(self,
159161
databases,
160162
blacklist,
161163
schemasDir,
162-
api_auth_token=None):
164+
api_auth_token=None,
165+
ignore_regressions=False):
163166
self.name = name
164167
self.zorgURL = zorgURL
165168
self.dbDir = dbDir
@@ -174,6 +177,7 @@ def __init__(self,
174177
for db in self.databases.values():
175178
db.config = self
176179
self.api_auth_token = api_auth_token
180+
self.ignore_regressions = ignore_regressions
177181

178182
def get_database(self, name):
179183
"""

lnt/server/ui/api.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -307,9 +307,12 @@ def post():
307307
data = request.get_data(as_text=True)
308308
select_machine = request.values.get('select_machine', 'match')
309309
merge = request.values.get('merge', None)
310+
ignore_regressions = request.values.get('ignore_regressions', False) \
311+
or getattr(current_app.old_config, 'ignore_regressions', False)
310312
result = lnt.util.ImportData.import_from_string(
311313
current_app.old_config, g.db_name, db, session, g.testsuite_name,
312-
data, select_machine=select_machine, merge_run=merge)
314+
data, select_machine=select_machine, merge_run=merge,
315+
ignore_regressions=ignore_regressions)
313316

314317
error = result['error']
315318
if error is not None:

lnt/server/ui/views.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,8 @@ def _do_submit():
116116
else:
117117
select_machine = request.form.get('select_machine', 'match')
118118
merge_run = request.form.get('merge', None)
119+
ignore_regressions = request.form.get('ignore_regressions', False) \
120+
or getattr(current_app.old_config, 'ignore_regressions', False)
119121

120122
if input_file and not input_file.content_length:
121123
input_file = None
@@ -156,7 +158,8 @@ def _do_submit():
156158

157159
result = lnt.util.ImportData.import_from_string(
158160
current_app.old_config, g.db_name, db, session, g.testsuite_name,
159-
data_value, select_machine=select_machine, merge_run=merge_run)
161+
data_value, select_machine=select_machine, merge_run=merge_run,
162+
ignore_regressions=ignore_regressions)
160163

161164
# It is nice to have a full URL to the run, so fixup the request URL
162165
# here were we know more about the flask instance.

lnt/util/ImportData.py

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
def import_and_report(config, db_name, db, session, file, format, ts_name,
1919
show_sample_count=False, disable_email=False,
2020
disable_report=False, select_machine=None,
21-
merge_run=None):
21+
merge_run=None, ignore_regressions=False):
2222
"""
2323
import_and_report(config, db_name, db, session, file, format, ts_name,
2424
[show_sample_count], [disable_email],
@@ -147,7 +147,10 @@ def import_and_report(config, db_name, db, session, file, format, ts_name,
147147
result['run_id'] = run.id
148148
session.commit()
149149

150-
fieldchange.post_submit_tasks(session, ts, run.id)
150+
if ignore_regressions:
151+
logger.info("Regenerating regressions skipped")
152+
else:
153+
fieldchange.post_submit_tasks(session, ts, run.id)
151154

152155
# Add a handy relative link to the submitted run.
153156
result['result_url'] = "db_{}/v4/{}/{}".format(db_name, ts_name, run.id)
@@ -173,7 +176,8 @@ def import_and_report(config, db_name, db, session, file, format, ts_name,
173176
show_sample_count, disable_email,
174177
disable_report,
175178
select_machine=select_machine,
176-
merge_run=merge_run)
179+
merge_run=merge_run,
180+
ignore_regressions=ignore_regressions)
177181

178182
# Append the shadow result to the result.
179183
result['shadow_result'] = shadow_result
@@ -319,7 +323,8 @@ def print_report_result(result, out, err, verbose=True):
319323

320324

321325
def import_from_string(config, db_name, db, session, ts_name, data,
322-
select_machine=None, merge_run=None):
326+
select_machine=None, merge_run=None,
327+
ignore_regressions=False):
323328
# Stash a copy of the raw submission.
324329
#
325330
# To keep the temporary directory organized, we keep files in
@@ -348,5 +353,6 @@ def import_from_string(config, db_name, db, session, ts_name, data,
348353

349354
result = lnt.util.ImportData.import_and_report(
350355
config, db_name, db, session, path, '<auto>', ts_name,
351-
select_machine=select_machine, merge_run=merge_run)
356+
select_machine=select_machine, merge_run=merge_run,
357+
ignore_regressions=ignore_regressions)
352358
return result

lnt/util/ServerUtil.py

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@ def _show_json_error(reply):
3232
sys.stderr.write(message + '\n')
3333

3434

35-
def submitFileToServer(url, file, select_machine=None, merge_run=None):
35+
def submitFileToServer(url, file, select_machine=None, merge_run=None,
36+
ignore_regressions=False):
3637
with open(file, 'rb') as f:
3738
values = {
3839
'input_data': f.read(),
@@ -42,6 +43,8 @@ def submitFileToServer(url, file, select_machine=None, merge_run=None):
4243
values['select_machine'] = select_machine
4344
if merge_run is not None:
4445
values['merge'] = merge_run
46+
if ignore_regressions:
47+
values['ignore_regressions'] = True
4548
headers = {'Accept': 'application/json'}
4649
data = urllib.parse.urlencode(values).encode(encoding='ascii')
4750
try:
@@ -72,7 +75,7 @@ def submitFileToServer(url, file, select_machine=None, merge_run=None):
7275

7376

7477
def submitFileToInstance(path, file, select_machine=None, merge_run=None,
75-
testsuite=None):
78+
testsuite=None, ignore_regressions=False):
7679
# Otherwise, assume it is a local url and submit to the default database
7780
# in the instance.
7881
instance = lnt.server.instance.Instance.frompath(path)
@@ -85,26 +88,28 @@ def submitFileToInstance(path, file, select_machine=None, merge_run=None,
8588
return lnt.util.ImportData.import_and_report(
8689
config, db_name, db, session, file, format='<auto>',
8790
ts_name=testsuite or 'nts', select_machine=select_machine,
88-
merge_run=merge_run)
91+
merge_run=merge_run, ignore_regressions=ignore_regressions)
8992

9093

9194
def submitFile(url, file, verbose, select_machine=None, merge_run=None,
92-
testsuite=None):
95+
testsuite=None, ignore_regressions=False):
9396
# If this is a real url, submit it using urllib.
9497
if '://' in url:
95-
result = submitFileToServer(url, file, select_machine, merge_run)
98+
result = submitFileToServer(url, file, select_machine, merge_run,
99+
ignore_regressions)
96100
else:
97101
result = submitFileToInstance(url, file, select_machine, merge_run,
98-
testsuite)
102+
testsuite, ignore_regressions)
99103
return result
100104

101105

102106
def submitFiles(url, files, verbose, select_machine=None, merge_run=None,
103-
testsuite=None):
107+
testsuite=None, ignore_regressions=False):
104108
results = []
105109
for file in files:
106110
result = submitFile(url, file, verbose, select_machine=select_machine,
107-
merge_run=merge_run, testsuite=testsuite)
111+
merge_run=merge_run, testsuite=testsuite,
112+
ignore_regressions=ignore_regressions)
108113
if result:
109114
results.append(result)
110115
return results

0 commit comments

Comments
 (0)