|
18 | 18 | # - BLAH
|
19 | 19 | # - PBS
|
20 | 20 | # - SGE
|
21 |
| -# - LSF |
| 21 | +# - LSF (5.x to 9.x) |
22 | 22 |
|
23 | 23 | '''
|
24 | 24 | @author: Konrad Jopek, Will Rogers
|
|
44 | 44 | from apel.parsers.pbs import PBSParser
|
45 | 45 | from apel.parsers.slurm import SlurmParser
|
46 | 46 | from apel.parsers.htcondor import HTCondorParser
|
47 |
| - |
| 47 | +from apel.parsers.htcondorce import HTCondorCEParser |
48 | 48 |
|
49 | 49 | LOGGER_ID = 'parser'
|
50 | 50 | # How many records should be put/fetched to/from database
|
|
57 | 57 | 'SGE': SGEParser,
|
58 | 58 | 'SLURM': SlurmParser,
|
59 | 59 | 'blah' : BlahParser,
|
60 |
| - 'HTCondor': HTCondorParser, |
| 60 | + 'htcondorce' : HTCondorCEParser, |
| 61 | + 'HTCONDOR' : HTCondorParser |
61 | 62 | }
|
62 | 63 |
|
63 |
| - |
64 | 64 | class ParserConfigException(Exception):
|
65 | 65 | '''
|
66 | 66 | Exception raised when parser is misconfigured.
|
@@ -154,14 +154,20 @@ def scan_dir(parser, dirpath, reparse, expr, apel_db, processed):
|
154 | 154 | '''
|
155 | 155 | log = logging.getLogger(LOGGER_ID)
|
156 | 156 | updated = []
|
| 157 | + |
| 158 | + parserName = parser.__class__.__name__ |
157 | 159 | try:
|
158 | 160 | log.info('Scanning directory: %s', dirpath)
|
159 | 161 |
|
160 |
| - for item in sorted(os.listdir(dirpath)): |
| 162 | + for item in os.listdir(dirpath): |
161 | 163 | abs_file = os.path.join(dirpath, item)
|
162 | 164 | if os.path.isfile(abs_file) and expr.match(item):
|
163 | 165 | # first, calculate the hash of the file:
|
164 |
| - file_hash = calculate_hash(abs_file) |
| 166 | + if parserName == "HTCondorCEParser": |
| 167 | + file_hash = "htce_" + calculate_hash(abs_file) |
| 168 | + else: |
| 169 | + file_hash = calculate_hash(abs_file) |
| 170 | + |
165 | 171 | found = False
|
166 | 172 | unparsed = False
|
167 | 173 | # next, try to find corresponding entry
|
@@ -238,6 +244,8 @@ def handle_parsing(log_type, apel_db, cp):
|
238 | 244 | log.info('Setting up parser for %s files', log_type)
|
239 | 245 | if log_type == 'blah':
|
240 | 246 | section = 'blah'
|
| 247 | + if log_type == 'htcondorce': |
| 248 | + section = 'htcondorce' |
241 | 249 | else:
|
242 | 250 | section = 'batch'
|
243 | 251 |
|
@@ -277,21 +285,13 @@ def handle_parsing(log_type, apel_db, cp):
|
277 | 285 | raise ParserConfigException(e)
|
278 | 286 | except KeyError, e:
|
279 | 287 | raise ParserConfigException("Not a valid parser type: %s" % e)
|
280 |
| - |
281 |
| - # Set parser specific options |
| 288 | + |
282 | 289 | if log_type == 'LSF':
|
283 | 290 | try:
|
284 | 291 | parser.set_scaling(cp.getboolean('batch', 'scale_host_factor'))
|
285 | 292 | except ConfigParser.NoOptionError:
|
286 |
| - log.warning("Option 'scale_host_factor' not found in section 'batch" |
287 |
| - "'. Will default to 'false'.") |
288 |
| - elif log_type == 'SGE': |
289 |
| - try: |
290 |
| - parser.set_ms_timestamps(cp.getboolean('batch', 'ge_ms_timestamps')) |
291 |
| - except ConfigParser.NoOptionError: |
292 |
| - log.warning("Option 'ge_ms_timestamps' not found in section 'batch'" |
293 |
| - " . Will default to 'false'.") |
294 |
| - |
| 293 | + pass |
| 294 | + |
295 | 295 | # regular expressions for blah log files and for batch log files
|
296 | 296 | try:
|
297 | 297 | prefix = cp.get(section, 'filename_prefix')
|
@@ -390,6 +390,17 @@ def main():
|
390 | 390 | log.info(LOG_BREAK)
|
391 | 391 | sys.exit(1)
|
392 | 392 |
|
| 393 | + log.info(LOG_BREAK) |
| 394 | + # htcondorce parsing |
| 395 | + try: |
| 396 | + if cp.getboolean('htcondorce', 'enabled'): |
| 397 | + handle_parsing('htcondorce', apel_db, cp) |
| 398 | + except (ParserConfigException, ConfigParser.NoOptionError), e: |
| 399 | + log.fatal('Parser misconfigured: %s', e) |
| 400 | + log.fatal('Parser will exit.') |
| 401 | + log.info(LOG_BREAK) |
| 402 | + sys.exit(1) |
| 403 | + |
393 | 404 | log.info(LOG_BREAK)
|
394 | 405 | # batch parsing
|
395 | 406 | try:
|
|
0 commit comments