Add a little bit of support to grab info for making graphs
without using the jobfile. util/stats/db.py: util/stats/profile.py: Make it possible to send job as a string and to set the system separately from the job. --HG-- extra : convert_revision : 08aaebd3f9a1643bd41953b43f3b80dc97e6592f
This commit is contained in:
parent
a95fcf7df0
commit
adf47c95b0
2 changed files with 23 additions and 13 deletions
|
@ -152,17 +152,24 @@ class Database(object):
|
||||||
self.method = 'sum'
|
self.method = 'sum'
|
||||||
self._method = type(self).sum
|
self._method = type(self).sum
|
||||||
|
|
||||||
def get(self, job, stat):
|
def get(self, job, stat, system=None):
|
||||||
run = self.allRunNames.get(job.name, None)
|
run = self.allRunNames.get(str(job), None)
|
||||||
if run is None:
|
if run is None:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
from info import scalar, vector, value, values, total, len
|
from info import ProxyError, scalar, vector, value, values, total, len
|
||||||
stat.system = self[job.system]
|
if system is None and hasattr('system', job):
|
||||||
if scalar(stat):
|
system = job.system
|
||||||
return value(stat, run.run)
|
|
||||||
if vector(stat):
|
if system is not None:
|
||||||
return values(stat, run.run)
|
stat.system = self[system]
|
||||||
|
try:
|
||||||
|
if scalar(stat):
|
||||||
|
return value(stat, run.run)
|
||||||
|
if vector(stat):
|
||||||
|
return values(stat, run.run)
|
||||||
|
except ProxyError:
|
||||||
|
return None
|
||||||
|
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
|
@ -283,13 +283,16 @@ class Profile(object):
|
||||||
for cpu,data in cpus.iteritems():
|
for cpu,data in cpus.iteritems():
|
||||||
yield run,cpu,data
|
yield run,cpu,data
|
||||||
|
|
||||||
def get(self, job, stat):
|
def get(self, job, stat, system=None):
|
||||||
if job.system is None:
|
if system is None and hasattr('system', job):
|
||||||
|
system = job.system
|
||||||
|
|
||||||
|
if system is None:
|
||||||
raise AttributeError, 'The job must have a system set'
|
raise AttributeError, 'The job must have a system set'
|
||||||
|
|
||||||
run = job.name
|
cpu = '%s.run%d' % (system, self.cpu)
|
||||||
cpu = '%s.run%d' % (job.system, self.cpu)
|
|
||||||
data = self.getdata(run, cpu)
|
data = self.getdata(str(job), cpu)
|
||||||
if not data:
|
if not data:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue