If no ToE, use eventtime.

This commit is contained in:
Joachim Meyer 2022-11-08 17:40:49 +01:00
parent 35c6ee3b47
commit 253784d94d

View File

@ -9,6 +9,7 @@
# #
# -- Michael Schwarz <schwarz@uni-paderborn.de> # -- Michael Schwarz <schwarz@uni-paderborn.de>
from dateutil import parser as dateparser
import platform import platform
import subprocess import subprocess
import json import json
@ -52,7 +53,7 @@ class CCApi:
return r.json() return r.json()
else: else:
print(data) print(data)
print(r) print(r.status_code, r.content)
return False return False
def getJobs(self, filter_running=True): def getJobs(self, filter_running=True):
@ -370,9 +371,13 @@ class CondorSync:
data = { data = {
'jobId': jobId, 'jobId': jobId,
'cluster': self.config['cluster'], 'cluster': self.config['cluster'],
'stopTime': job['ToE']['When'],
'jobState': jobstate 'jobState': jobstate
} }
if 'ToE' in job:
data['stopTime'] = job['ToE']['When']
else:
data['stopTime'] = int(time.mktime(dateparser.parse(job['EventTime']).timetuple()))
if 'JobCurrentStartDate' in job: if 'JobCurrentStartDate' in job:
data['startTime'] = job['JobCurrentStartDate'] data['startTime'] = job['JobCurrentStartDate']
@ -392,8 +397,7 @@ class CondorSync:
if event['EventTypeNumber'] == 28: # JobAdInformationEvent if event['EventTypeNumber'] == 28: # JobAdInformationEvent
if event['TriggerEventTypeNumber'] == 1: # Execute if event['TriggerEventTypeNumber'] == 1: # Execute
self._ccStartJob(event) self._ccStartJob(event)
# elif event['TriggerEventTypeNumber'] == 4 or elif event['TriggerEventTypeNumber'] == 4 or event['TriggerEventTypeNumber'] == 5 or \
elif event['TriggerEventTypeNumber'] == 5 or \
event['TriggerEventTypeNumber'] == 9 or event['TriggerEventTypeNumber'] == 10 or \ event['TriggerEventTypeNumber'] == 9 or event['TriggerEventTypeNumber'] == 10 or \
event['TriggerEventTypeNumber'] == 12: event['TriggerEventTypeNumber'] == 12:
self._ccStopJob(event) self._ccStopJob(event)