[LNT] r308236 - Accept ISO8061 timestamps in run submission
Chris Matthews via llvm-commits
llvm-commits at lists.llvm.org
Mon Jul 17 17:26:20 PDT 2017
Author: cmatthews
Date: Mon Jul 17 17:26:20 2017
New Revision: 308236
URL: http://llvm.org/viewvc/llvm-project?rev=308236&view=rev
Log:
Accept ISO8061 timestamps in run submission
I'd like all of our timestamps to be 8061. For now, lets start allowing
us to accept them in run submissions.
Modified:
lnt/trunk/lnt/server/db/testsuitedb.py
Modified: lnt/trunk/lnt/server/db/testsuitedb.py
URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/lnt/server/db/testsuitedb.py?rev=308236&r1=308235&r2=308236&view=diff
==============================================================================
--- lnt/trunk/lnt/server/db/testsuitedb.py (original)
+++ lnt/trunk/lnt/server/db/testsuitedb.py Mon Jul 17 17:26:20 2017
@@ -9,6 +9,7 @@ import datetime
import json
import os
+import aniso8601
import sqlalchemy
from flask import session
from sqlalchemy import *
@@ -831,15 +832,24 @@ class TestSuiteDB(object):
# Find the order record.
order, inserted = self._getOrCreateOrder(run_parameters)
- start_time = datetime.datetime.strptime(run_data['start_time'],
- "%Y-%m-%d %H:%M:%S")
- end_time = datetime.datetime.strptime(run_data['end_time'],
+
+ # We'd like ISO8061 timestamps, but will also accept the old format.
+ try:
+ start_time = aniso8601.parse_datetime(run_data['start_time'])
+ except ValueError:
+ start_time = datetime.datetime.strptime(run_data['start_time'],
+ "%Y-%m-%d %H:%M:%S")
+
+ try:
+ end_time = aniso8601.parse_datetime(run_data['end_time'])
+ except ValueError:
+ end_time = datetime.datetime.strptime(run_data['end_time'],
"%Y-%m-%d %H:%M:%S")
run_parameters.pop('start_time')
run_parameters.pop('end_time')
# Convert the rundata into a run record. As with Machines, we construct
- # the query to look for any existingrun at the same time as we build up
+ # the query to look for any existing run at the same time as we build up
# the record to possibly add.
#
# FIXME: This feels inelegant, can't SA help us out here?
More information about the llvm-commits
mailing list