db.py (2006:3ca085495c69) db.py (2014:7df693ff6fa4)
1# Copyright (c) 2003-2004 The Regents of The University of Michigan
2# All rights reserved.
3#
4# Redistribution and use in source and binary forms, with or without
5# modification, are permitted provided that the following conditions are
6# met: redistributions of source code must retain the above copyright
7# notice, this list of conditions and the following disclaimer;
8# redistributions in binary form must reproduce the above copyright

--- 138 unchanged lines hidden (view full) ---

147
148 self.mode = 'sum';
149 self.runs = None
150 self.bins = None
151 self.ticks = None
152 self.method = 'sum'
153 self._method = type(self).sum
154
1# Copyright (c) 2003-2004 The Regents of The University of Michigan
2# All rights reserved.
3#
4# Redistribution and use in source and binary forms, with or without
5# modification, are permitted provided that the following conditions are
6# met: redistributions of source code must retain the above copyright
7# notice, this list of conditions and the following disclaimer;
8# redistributions in binary form must reproduce the above copyright

--- 138 unchanged lines hidden (view full) ---

147
148 self.mode = 'sum';
149 self.runs = None
150 self.bins = None
151 self.ticks = None
152 self.method = 'sum'
153 self._method = type(self).sum
154
155 def get(self, job, stat):
156 run = self.allRunNames.get(job.name, None)
155 def get(self, job, stat, system=None):
156 run = self.allRunNames.get(str(job), None)
157 if run is None:
158 return None
159
157 if run is None:
158 return None
159
160 from info import scalar, vector, value, values, total, len
161 stat.system = self[job.system]
162 if scalar(stat):
163 return value(stat, run.run)
164 if vector(stat):
165 return values(stat, run.run)
160 from info import ProxyError, scalar, vector, value, values, total, len
161 if system is None and hasattr('system', job):
162 system = job.system
166
163
164 if system is not None:
165 stat.system = self[system]
166 try:
167 if scalar(stat):
168 return value(stat, run.run)
169 if vector(stat):
170 return values(stat, run.run)
171 except ProxyError:
172 return None
173
167 return None
168
169 def query(self, sql):
170 self.cursor.execute(sql)
171
172 def update_dict(self, dict):
173 dict.update(self.stattop)
174

--- 324 unchanged lines hidden ---
174 return None
175
176 def query(self, sql):
177 self.cursor.execute(sql)
178
179 def update_dict(self, dict):
180 dict.update(self.stattop)
181

--- 324 unchanged lines hidden ---