本文整理匯總了Python中DIRAC.WorkloadManagementSystem.DB.JobLoggingDB.JobLoggingDB.getJobLoggingInfo方法的典型用法代碼示例。如果您正苦於以下問題:Python JobLoggingDB.getJobLoggingInfo方法的具體用法?Python JobLoggingDB.getJobLoggingInfo怎麽用?Python JobLoggingDB.getJobLoggingInfo使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類DIRAC.WorkloadManagementSystem.DB.JobLoggingDB.JobLoggingDB
的用法示例。
在下文中一共展示了JobLoggingDB.getJobLoggingInfo方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: StalledJobAgent
# 需要導入模塊: from DIRAC.WorkloadManagementSystem.DB.JobLoggingDB import JobLoggingDB [as 別名]
# 或者: from DIRAC.WorkloadManagementSystem.DB.JobLoggingDB.JobLoggingDB import getJobLoggingInfo [as 別名]
#.........這裏部分代碼省略.........
"""
result = self.jobDB.getHeartBeatData( jobID )
lastCPUTime = 0
lastWallTime = 0
lastHeartBeatTime = jobDict['StartExecTime']
if lastHeartBeatTime == "None":
lastHeartBeatTime = 0
if result['OK']:
for name, value, heartBeatTime in result['Value']:
if 'CPUConsumed' == name:
try:
value = int( float( value ) )
if value > lastCPUTime:
lastCPUTime = value
except ValueError:
pass
if 'WallClockTime' == name:
try:
value = int( float( value ) )
if value > lastWallTime:
lastWallTime = value
except ValueError:
pass
if heartBeatTime > lastHeartBeatTime:
lastHeartBeatTime = heartBeatTime
return lastCPUTime, lastWallTime, lastHeartBeatTime
def __checkLoggingInfo( self, jobID, jobDict ):
""" Get info from JobLogging
"""
logList = []
result = self.logDB.getJobLoggingInfo( jobID )
if result['OK']:
logList = result['Value']
startTime = jobDict['StartExecTime']
if not startTime or startTime == 'None':
# status, minor, app, stime, source
for items in logList:
if items[0] == 'Running':
startTime = items[3]
break
if not startTime or startTime == 'None':
startTime = jobDict['SubmissionTime']
if type( startTime ) in types.StringTypes:
startTime = fromString( startTime )
if startTime == None:
self.log.error( 'Wrong timestamp in DB', items[3] )
startTime = dateTime()
endTime = dateTime()
# status, minor, app, stime, source
for items in logList:
if items[0] == 'Stalled':
endTime = fromString( items[3] )
if endTime == None:
self.log.error( 'Wrong timestamp in DB', items[3] )
endTime = dateTime()
return startTime, endTime
def __kickStuckJobs( self ):
示例2: StalledJobAgent
# 需要導入模塊: from DIRAC.WorkloadManagementSystem.DB.JobLoggingDB import JobLoggingDB [as 別名]
# 或者: from DIRAC.WorkloadManagementSystem.DB.JobLoggingDB.JobLoggingDB import getJobLoggingInfo [as 別名]
#.........這裏部分代碼省略.........
"""
result = self.jobDB.getHeartBeatData(jobID)
lastCPUTime = 0
lastWallTime = 0
lastHeartBeatTime = jobDict["StartExecTime"]
if lastHeartBeatTime == "None":
lastHeartBeatTime = 0
if result["OK"]:
for name, value, heartBeatTime in result["Value"]:
if "CPUConsumed" == name:
try:
value = int(float(value))
if value > lastCPUTime:
lastCPUTime = value
except ValueError:
pass
if "WallClockTime" == name:
try:
value = int(float(value))
if value > lastWallTime:
lastWallTime = value
except ValueError:
pass
if heartBeatTime > lastHeartBeatTime:
lastHeartBeatTime = heartBeatTime
return lastCPUTime, lastWallTime, lastHeartBeatTime
def __checkLoggingInfo(self, jobID, jobDict):
""" Get info from JobLogging
"""
logList = []
result = self.logDB.getJobLoggingInfo(jobID)
if result["OK"]:
logList = result["Value"]
startTime = jobDict["StartExecTime"]
if not startTime or startTime == "None":
# status, minor, app, stime, source
for items in logList:
if items[0] == "Running":
startTime = items[3]
break
if not startTime or startTime == "None":
startTime = jobDict["SubmissionTime"]
if type(startTime) in types.StringTypes:
startTime = fromString(startTime)
if startTime == None:
self.log.error("Wrong timestamp in DB", items[3])
startTime = dateTime()
endTime = dateTime()
# status, minor, app, stime, source
for items in logList:
if items[0] == "Stalled":
endTime = fromString(items[3])
if endTime == None:
self.log.error("Wrong timestamp in DB", items[3])
endTime = dateTime()
return startTime, endTime
def __kickStuckJobs(self):
""" Reschedule jobs stuck in initialization status Rescheduled, Matched