diff options
author | Nathan Binkert <binkertn@umich.edu> | 2006-02-23 00:20:32 -0500 |
---|---|---|
committer | Nathan Binkert <binkertn@umich.edu> | 2006-02-23 00:20:32 -0500 |
commit | 35094fb0fe7113be4d2faa88beb505d3e9155a77 (patch) | |
tree | 3b7db7d03d355a693ca02e6ffc4286b494e2aa28 | |
parent | cc60bc49e6b448f9119b2195d393cd50ffeb90cb (diff) | |
download | gem5-35094fb0fe7113be4d2faa88beb505d3e9155a77.tar.xz |
make it possible to add filters for job names so that
parts of the full crossproduct of jobs can be ignored.
--HG--
extra : convert_revision : c44b3daea0cf4b487b1d99eae92da16573b15930
-rw-r--r-- | util/pbs/jobfile.py | 34 |
1 files changed, 31 insertions, 3 deletions
diff --git a/util/pbs/jobfile.py b/util/pbs/jobfile.py index d36b5ee6d..5cdd343de 100644 --- a/util/pbs/jobfile.py +++ b/util/pbs/jobfile.py @@ -1,4 +1,4 @@ -# Copyright (c) 2005 The Regents of The University of Michigan +# Copyright (c) 2005-2006 The Regents of The University of Michigan # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -356,6 +356,8 @@ class Configuration(Data): def __init__(self, name, desc, **kwargs): super(Configuration, self).__init__(name, desc, **kwargs) self._groups = [] + self._posfilters = [] + self._negfilters = [] def group(self, name, desc, **kwargs): grp = Group(name, desc, **kwargs) @@ -402,13 +404,39 @@ class Configuration(Data): if checkpoint: yield options + def addfilter(self, filt, pos=True): + import re + filt = re.compile(filt) + if pos: + self._posfilters.append(filt) + else: + self._negfilters.append(filt) + + def jobfilter(self, job): + for filt in self._negfilters: + if filt.match(job.name): + return False + + if not self._posfilters: + return True + + for filt in self._posfilters: + if filt.match(job.name): + return True + + return False + def checkpoints(self, groups = None): for options in self.options(groups, True): - yield Job(options) + job = Job(options) + if self.jobfilter(job): + yield job def jobs(self, groups = None): for options in self.options(groups, False): - yield Job(options) + job = Job(options) + if self.jobfilter(job): + yield job def alljobs(self, groups = None): for options in self.options(groups, True): |