[PATCH] D52593: [LNT] Sort fields according to order defined in YAML files.
Martin Liška via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Oct 1 05:34:24 PDT 2018
This revision was automatically updated to reflect the committed changes.
Closed by commit rL343466: Sort fields according to order defined in YAML files. (authored by marxin, committed by ).
Herald added a subscriber: llvm-commits.
Changed prior to commit:
https://reviews.llvm.org/D52593?vs=167260&id=167713#toc
Repository:
rL LLVM
https://reviews.llvm.org/D52593
Files:
lnt/trunk/lnt/server/db/testsuite.py
lnt/trunk/lnt/server/db/testsuitedb.py
Index: lnt/trunk/lnt/server/db/testsuitedb.py
===================================================================
--- lnt/trunk/lnt/server/db/testsuitedb.py
+++ lnt/trunk/lnt/server/db/testsuitedb.py
@@ -86,8 +86,10 @@
self.machine_fields = list(self.test_suite.machine_fields)
self.order_fields = list(self.test_suite.order_fields)
self.run_fields = list(self.test_suite.run_fields)
- self.sample_fields = list(self.test_suite.sample_fields)
+ self.sample_fields = list(sorted(self.test_suite.sample_fields,
+ key = lambda s: s.schema_index))
sample_field_indexes = dict()
+
for i, field in enumerate(self.sample_fields):
sample_field_indexes[field.name] = i
self.sample_field_indexes = sample_field_indexes
@@ -461,7 +463,7 @@
class Sample(self.base, ParameterizedMixin):
__tablename__ = db_key_name + '_Sample'
- fields = self.sample_fields
+ fields = list(sorted(self.sample_fields, key = lambda x: self.sample_field_indexes[x.name]))
id = Column("ID", Integer, primary_key=True)
# We do not need an index on run_id, this is covered by the
# compound (Run(ID),Test(ID)) index we create below.
Index: lnt/trunk/lnt/server/db/testsuite.py
===================================================================
--- lnt/trunk/lnt/server/db/testsuite.py
+++ lnt/trunk/lnt/server/db/testsuite.py
@@ -143,7 +143,7 @@
assert(len(order_fields) > 0)
sample_fields = []
- for metric_desc in data['metrics']:
+ for index, metric_desc in enumerate(data['metrics']):
name = metric_desc['name']
bigger_is_better = metric_desc.get('bigger_is_better', False)
metric_type_name = metric_desc.get('type', 'Real')
@@ -155,7 +155,7 @@
metric_type_name)
metric_type = SampleType(metric_type_name)
bigger_is_better_int = 1 if bigger_is_better else 0
- field = SampleField(name, metric_type, status_field=None,
+ field = SampleField(name, metric_type, index, status_field=None,
bigger_is_better=bigger_is_better_int,
display_name=display_name, unit=unit,
unit_abbrev=unit_abbrev)
@@ -312,15 +312,16 @@
# This assumption can be inverted by setting this column to nonzero.
bigger_is_better = Column("bigger_is_better", Integer)
- def __init__(self, name, type, status_field=None, bigger_is_better=0,
+ def __init__(self, name, type, schema_index, status_field=None, bigger_is_better=0,
display_name=None, unit=None, unit_abbrev=None):
self.name = name
self.type = type
self.status_field = status_field
self.bigger_is_better = bigger_is_better
self.display_name = name if display_name is None else display_name
self.unit = unit
self.unit_abbrev = unit_abbrev
+ self.schema_index = schema_index
# Column instance for fields which have been bound (non-DB
# parameter). This is provided for convenience in querying.
@@ -331,19 +332,21 @@
self.display_name = self.name
self.unit = None
self.unit_abbrev = None
+ self.schema_index = -1
def __repr__(self):
return '%s%r' % (self.__class__.__name__, (self.name, self.type, ))
def __copy__(self):
- return SampleField(self.name, self.type, self.status_field,
+ return SampleField(self.name, self.type, self.schema_index, self.status_field,
self.bigger_is_better, self.display_name, self.unit,
self.unit_abbrev)
def copy_info(self, other):
self.display_name = other.display_name
self.unit = other.unit
self.unit_abbrev = other.unit_abbrev
+ self.schema_index = other.schema_index
def _upgrade_to(connectable, tsschema, new_schema, dry_run=False):
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D52593.167713.patch
Type: text/x-patch
Size: 4091 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181001/bc2b063e/attachment.bin>
More information about the llvm-commits
mailing list