[LNT] r317389 - Change duplicate submission default to 'reject'
Matthias Braun via llvm-commits
llvm-commits at lists.llvm.org
Fri Nov 3 16:35:09 PDT 2017
Author: matze
Date: Fri Nov 3 16:35:08 2017
New Revision: 317389
URL: http://llvm.org/viewvc/llvm-project?rev=317389&view=rev
Log:
Change duplicate submission default to 'reject'
The previous default of 'replace' would delete the previous run in case
of a duplicate submission (a submission to the same machine with the
same order number). This caused confusion to unsuspecting users as runs
would magically disappear. Change the default to 'reject' so it is more
obvious that something was strange on the submission side.
Modified:
lnt/trunk/lnt/server/ui/api.py
lnt/trunk/lnt/server/ui/views.py
lnt/trunk/lnt/tests/nt.py
lnt/trunk/lnt/util/ImportData.py
lnt/trunk/lnt/util/ServerUtil.py
lnt/trunk/tests/runtest/nt.py
lnt/trunk/tests/server/ui/test_roundtrip.py
Modified: lnt/trunk/lnt/server/ui/api.py
URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/lnt/server/ui/api.py?rev=317389&r1=317388&r2=317389&view=diff
==============================================================================
--- lnt/trunk/lnt/server/ui/api.py (original)
+++ lnt/trunk/lnt/server/ui/api.py Fri Nov 3 16:35:08 2017
@@ -278,7 +278,7 @@ class Runs(Resource):
db = request.get_db()
data = request.data
select_machine = request.values.get('select_machine', 'match')
- merge = request.values.get('merge', 'replace')
+ merge = request.values.get('merge', None)
result = lnt.util.ImportData.import_from_string(
current_app.old_config, g.db_name, db, session, g.testsuite_name,
data, select_machine=select_machine, merge_run=merge)
Modified: lnt/trunk/lnt/server/ui/views.py
URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/lnt/server/ui/views.py?rev=317389&r1=317388&r2=317389&view=diff
==============================================================================
--- lnt/trunk/lnt/server/ui/views.py (original)
+++ lnt/trunk/lnt/server/ui/views.py Fri Nov 3 16:35:08 2017
@@ -108,7 +108,7 @@ def _do_submit():
select_machine = 'update' if update_machine else 'match'
else:
select_machine = request.form.get('select_machine', 'match')
- merge_run = request.form.get('merge', 'replace')
+ merge_run = request.form.get('merge', None)
if input_file and not input_file.content_length:
input_file = None
Modified: lnt/trunk/lnt/tests/nt.py
URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/lnt/tests/nt.py?rev=317389&r1=317388&r2=317389&view=diff
==============================================================================
--- lnt/trunk/lnt/tests/nt.py (original)
+++ lnt/trunk/lnt/tests/nt.py Fri Nov 3 16:35:08 2017
@@ -1662,6 +1662,7 @@ class NTTest(builtintest.BuiltinTest):
.format(config.qemu_user_mode_command))
# Multisample, if requested.
+ merge_run = None
if opts.multisample is not None:
# Collect the sample reports.
reports = []
@@ -1705,11 +1706,12 @@ class NTTest(builtintest.BuiltinTest):
lnt_report_file = open(lnt_report_path, 'w')
print >>lnt_report_file, test_results.render()
lnt_report_file.close()
+ merge_run = 'replace'
if config.output is not None:
self.print_report(test_results, config.output)
- server_report = self.submit_helper(config)
+ server_report = self.submit_helper(config, merge_run)
ImportData.print_report_result(server_report,
sys.stdout,
@@ -1717,7 +1719,7 @@ class NTTest(builtintest.BuiltinTest):
config.verbose)
return server_report
- def submit_helper(self, config):
+ def submit_helper(self, config, merge_run=None):
"""Submit the report to the server. If no server
was specified, use a local mock server.
"""
@@ -1731,7 +1733,8 @@ class NTTest(builtintest.BuiltinTest):
for server in config.submit_url:
self.log("submitting result to %r" % (server,))
try:
- result = ServerUtil.submitFile(server, report_path, False)
+ result = ServerUtil.submitFile(server, report_path, False,
+ merge_run=merge_run)
except (urllib2.HTTPError, urllib2.URLError) as e:
logger.warning("submitting to {} failed with {}"
.format(server, e))
Modified: lnt/trunk/lnt/util/ImportData.py
URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/lnt/util/ImportData.py?rev=317389&r1=317388&r2=317389&view=diff
==============================================================================
--- lnt/trunk/lnt/util/ImportData.py (original)
+++ lnt/trunk/lnt/util/ImportData.py Fri Nov 3 16:35:08 2017
@@ -14,8 +14,8 @@ import time
def import_and_report(config, db_name, db, session, file, format, ts_name,
show_sample_count=False, disable_email=False,
- disable_report=False, select_machine='match',
- merge_run='replace'):
+ disable_report=False, select_machine=None,
+ merge_run=None):
"""
import_and_report(config, db_name, db, session, file, format, ts_name,
[show_sample_count], [disable_email],
@@ -33,6 +33,10 @@ def import_and_report(config, db_name, d
'error': None,
'import_file': file,
}
+ if select_machine is None:
+ select_machine = 'match'
+ if merge_run is None:
+ merge_run = 'reject'
if select_machine not in ('match', 'update', 'split'):
result['error'] = "select_machine must be 'match', 'update' or 'split'"
@@ -313,7 +317,7 @@ def print_report_result(result, out, err
def import_from_string(config, db_name, db, session, ts_name, data,
- select_machine='match', merge_run='replace'):
+ select_machine=None, merge_run=None):
# Stash a copy of the raw submission.
#
# To keep the temporary directory organized, we keep files in
Modified: lnt/trunk/lnt/util/ServerUtil.py
URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/lnt/util/ServerUtil.py?rev=317389&r1=317388&r2=317389&view=diff
==============================================================================
--- lnt/trunk/lnt/util/ServerUtil.py (original)
+++ lnt/trunk/lnt/util/ServerUtil.py Fri Nov 3 16:35:08 2017
@@ -29,14 +29,16 @@ def _show_json_error(reply):
sys.stderr.write(message + '\n')
-def submitFileToServer(url, file, select_machine, merge_run):
+def submitFileToServer(url, file, select_machine=None, merge_run=None):
with open(file, 'rb') as f:
values = {
'input_data': f.read(),
'commit': "1", # compatibility with old servers.
- 'select_machine': select_machine,
- 'merge': merge_run,
}
+ if select_machine is not None:
+ values['select_machine'] = select_machine
+ if merge_run is not None:
+ values['merge'] = merge_run
headers = {'Accept': 'application/json'}
data = urllib.urlencode(values)
try:
@@ -63,8 +65,7 @@ def submitFileToServer(url, file, select
return reply
-def submitFileToInstance(path, file, select_machine='match',
- merge_run='replace'):
+def submitFileToInstance(path, file, select_machine=None, merge_run=None):
# Otherwise, assume it is a local url and submit to the default database
# in the instance.
instance = lnt.server.instance.Instance.frompath(path)
@@ -79,8 +80,7 @@ def submitFileToInstance(path, file, sel
select_machine=select_machine, merge_run=merge_run)
-def submitFile(url, file, verbose, select_machine='match',
- merge_run='replace'):
+def submitFile(url, file, verbose, select_machine=None, merge_run=None):
# If this is a real url, submit it using urllib.
if '://' in url:
result = submitFileToServer(url, file, select_machine, merge_run)
@@ -89,8 +89,7 @@ def submitFile(url, file, verbose, selec
return result
-def submitFiles(url, files, verbose, select_machine='match',
- merge_run='replace'):
+def submitFiles(url, files, verbose, select_machine=None, merge_run=None):
results = []
for file in files:
result = submitFile(url, file, verbose, select_machine=select_machine,
Modified: lnt/trunk/tests/runtest/nt.py
URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/tests/runtest/nt.py?rev=317389&r1=317388&r2=317389&view=diff
==============================================================================
--- lnt/trunk/tests/runtest/nt.py (original)
+++ lnt/trunk/tests/runtest/nt.py Fri Nov 3 16:35:08 2017
@@ -189,6 +189,6 @@
# RUN: --sandbox %t.SANDBOX \
# RUN: --test-suite %S/Inputs/rerun-test-suite1 \
# RUN: --cc %{shared_inputs}/FakeCompilers/clang-r154331 \
-# RUN: --no-timestamp --rerun --run-order 1 > %t.log 2> %t.err
+# RUN: --no-timestamp --rerun --run-order 2 > %t.log 2> %t.err
# RUN: FileCheck --check-prefix CHECK-SUBMIT-STDOUT < %t.log %s
# RUN: FileCheck --check-prefix CHECK-SUBMIT-STDERR < %t.err %s
Modified: lnt/trunk/tests/server/ui/test_roundtrip.py
URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/tests/server/ui/test_roundtrip.py?rev=317389&r1=317388&r2=317389&view=diff
==============================================================================
--- lnt/trunk/tests/server/ui/test_roundtrip.py (original)
+++ lnt/trunk/tests/server/ui/test_roundtrip.py Fri Nov 3 16:35:08 2017
@@ -14,6 +14,7 @@ import unittest
import lnt.server.db.migrate
import lnt.server.ui.app
+import copy
from V4Pages import check_json
logging.basicConfig(level=logging.DEBUG)
@@ -60,16 +61,18 @@ class JSONAPIRoundTripTester(unittest.Te
# able to set them to anything without anyone complaining.
self.assertEqual(orig_api_run['machine']['id'], 1)
- new_api_run, result_url = self._resubmit(orig_api_run)
+ modified_run = copy.deepcopy(orig_api_run)
+ modified_run['run']['llvm_project_revision'] = u'666'
+ new_api_run, result_url = self._resubmit(modified_run)
self.assertEqual(result_url, 'http://localhost/db_default/v4/nts/10')
self.assertEqual(new_api_run['run']['id'], 10)
+ self.assertEqual(new_api_run['run']['llvm_project_revision'], u'666')
+ new_api_run['run']['llvm_project_revision'] = orig_api_run['run']['llvm_project_revision']
# We change run id and machine id back to the original and after that
# we should have a perfect match.
self._compare_results(new_api_run, orig_api_run)
- final_run_api, _ = self._resubmit(new_api_run)
- self._compare_results(new_api_run, final_run_api)
def _compare_results(self, after_submit_run, before_submit_run):
"""Take the results from server submission and compare them.
More information about the llvm-commits
mailing list