[LNT] r308704 - api: Write a log message for all modifying machine operations
Matthias Braun via llvm-commits
llvm-commits at lists.llvm.org
Thu Jul 20 17:56:38 PDT 2017
Author: matze
Date: Thu Jul 20 17:56:38 2017
New Revision: 308704
URL: http://llvm.org/viewvc/llvm-project?rev=308704&view=rev
Log:
api: Write a log message for all modifying machine operations
Modified:
lnt/trunk/lnt/server/db/testsuitedb.py
lnt/trunk/lnt/server/ui/api.py
lnt/trunk/tests/server/ui/test_api_modify.py
Modified: lnt/trunk/lnt/server/db/testsuitedb.py
URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/lnt/server/db/testsuitedb.py?rev=308704&r1=308703&r2=308704&view=diff
==============================================================================
--- lnt/trunk/lnt/server/db/testsuitedb.py (original)
+++ lnt/trunk/lnt/server/db/testsuitedb.py Thu Jul 20 17:56:38 2017
@@ -371,7 +371,7 @@ class TestSuiteDB(object):
_dict_update_abort_on_duplicates(result,
self.order.__json__(include_id=False))
result['order_by'] = \
- ', '.join([f.name for f in self.order.fields])
+ ','.join([f.name for f in self.order.fields])
result['order_id'] = self.order_id
else:
result['order_id'] = self.order_id
Modified: lnt/trunk/lnt/server/ui/api.py
URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/lnt/server/ui/api.py?rev=308704&r1=308703&r2=308704&view=diff
==============================================================================
--- lnt/trunk/lnt/server/ui/api.py (original)
+++ lnt/trunk/lnt/server/ui/api.py Thu Jul 20 17:56:38 2017
@@ -9,6 +9,7 @@ from sqlalchemy.orm.exc import NoResultF
from lnt.server.ui.util import convert_revision
from lnt.testing import PASS
+from lnt.util import logger
from functools import wraps
@@ -145,15 +146,20 @@ class Machine(Resource):
if len(runs) == 0:
break
at += len(runs)
- yield "Deleting runs %s (%d/%d)\n" % \
+ msg = "Deleting runs %s (%d/%d)" % \
(" ".join([str(run.id) for run in runs]), at, count)
+ logger.info(msg)
+ yield msg + '\n'
for run in runs:
ts.session.delete(run)
ts.commit()
+ machine_name = machine.name
ts.session.delete(machine)
ts.commit()
- yield "Deleted machine %s\n" % machine_id
+ msg = "Deleted machine %s:%s" % (machine_name, machine_id)
+ logger.info(msg)
+ yield msg + '\n'
stream = stream_with_context(perform_delete(ts, machine))
return Response(stream, mimetype="text/plain")
@@ -164,6 +170,7 @@ class Machine(Resource):
def post(machine_id):
ts = request.get_testsuite()
machine = Machine._get_machine(machine_id)
+ previous_name = machine.name
action = request.values.get('action', None)
if action is None:
@@ -178,6 +185,8 @@ class Machine(Resource):
abort(400, msg="Machine with name '%s' already exists" % name)
machine.name = name
ts.session.commit()
+ logger.info("Renamed machine %s:%s to %s" %
+ (previous_name, machine_id, name))
else:
abort(400, msg="Unknown action '%s'" % action)
@@ -228,6 +237,7 @@ class Run(Resource):
abort(404, msg="Did not find run " + str(run_id))
ts.delete(run)
ts.commit()
+ logger.info("Deleted run %s" % (run_id,))
class Runs(Resource):
Modified: lnt/trunk/tests/server/ui/test_api_modify.py
URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/tests/server/ui/test_api_modify.py?rev=308704&r1=308703&r2=308704&view=diff
==============================================================================
--- lnt/trunk/tests/server/ui/test_api_modify.py (original)
+++ lnt/trunk/tests/server/ui/test_api_modify.py Thu Jul 20 17:56:38 2017
@@ -114,7 +114,7 @@ class JSONAPIDeleteTester(unittest.TestC
self.assertEqual(resp.status_code, 200)
self.assertEqual(resp.get_data(),
'''Deleting runs 3 5 6 7 8 9 (6/6)
-Deleted machine 2
+Deleted machine machine2:2
''')
resp = client.get('api/db_default/v4/nts/machines/2')
More information about the llvm-commits
mailing list