Skip to content

Commit

Permalink
Merge pull request #1 from DarkEnergySurvey/condor9updates
Browse files Browse the repository at this point in the history
Condor9updates
  • Loading branch information
astro-friedel authored Apr 29, 2022
2 parents ea928a6 + 9c7a313 commit 31b5742
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 12 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ venv/
ENV/
env.bak/
venv.bak/
.idea/

# Spyder project settings
.spyderproject
Expand Down
27 changes: 15 additions & 12 deletions python/processingfw/pfwcondor.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
# $Id: pfwcondor.py 47226 2018-07-12 20:24:15Z friedel $
# $Rev:: 47226 $: # Revision of last commit.
# $LastChangedBy:: friedel $: # Author of last commit.
# $LastChangedDate:: 2018-07-12 15:24:15 #$: # Date of last commit.

# pylint: disable=print-statement

""" Utilities for interactions with Condor """
Expand Down Expand Up @@ -274,7 +269,13 @@ def write_condor_descfile(jobname, filename, jobattribs, userattribs=None):

def parse_condor_user_log(logfilename):
"""parses a condor log into a dictionary"""

cversion = int(condor_version().split('.')[0])
if cversion == 8:
pattern = re.compile(r'(\d+)\s+\((\d+).\d+.\d+\)\s+(\d+\/\d+\s+\d+:\d+:\d+)\s+(.+)')
elif cversion == 9:
pattern = re.compile(r'(\d+)\s+\((\d+).\d+.\d+\)\s+(\d+-\d+-\d+\s+\d+:\d+:\d+)\s+(.+)')
else:
raise CondorException(f'Unknown condor version: {cversion}')
#print "parse_condor_user_log: logfilename=", logfilename
log = open(logfilename)
lines = log.read().split('\n...\n')
Expand All @@ -288,17 +289,19 @@ def parse_condor_user_log(logfilename):
for line in lines:
if re.search(r'\S', line):
splitline = line.split('\n')
result = re.match(r'(\d+)\s+\((\d+).\d+.\d+\)\s+(\d+\/\d+\s+\d+:\d+:\d+)\s+(.+)',
splitline[0])
result = pattern.match(splitline[0])
if result:
code = result.group(1)
jobnum = result.group(2)
eventtime = result.group(3)
eventdate = datetime.strptime(eventtime, '%m/%d %H:%M:%S')
if eventdate.month == logmonth:
eventdate = eventdate.replace(year=logyear)
if cversion == 8:
eventdate = datetime.strptime(eventtime, '%m/%d %H:%M:%S')
if eventdate.month == logmonth:
eventdate = eventdate.replace(year=logyear)
else:
eventdate = eventdate.replace(year=logyear - 1)
else:
eventdate = eventdate.replace(year=logyear - 1)
eventdate = datetime.strptime(eventtime, '%Y-%m-%d %H:%M:%S')

#desc = result.group(4)

Expand Down

0 comments on commit 31b5742

Please sign in to comment.