本文整理汇总了Python中job.Job.read方法的典型用法代码示例。如果您正苦于以下问题:Python Job.read方法的具体用法?Python Job.read怎么用?Python Job.read使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类job.Job
的用法示例。
在下文中一共展示了Job.read方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: processFinishedJob
# 需要导入模块: from job import Job [as 别名]
# 或者: from job.Job import read [as 别名]
def processFinishedJob(jobID, resultStatus, updatedJobFiles, jobBatcher, childJobFileToParentJob, childCounts, config):
"""Function reads a processed job file and updates it state.
"""
jobFile = jobBatcher.removeJobID(jobID)
updatingFilePresent = processAnyUpdatingFile(jobFile)
newFilePresent = processAnyNewFile(jobFile)
jobDir = os.path.split(jobFile)[0]
if os.path.exists(getJobLogFileName(jobDir)):
logger.critical("The job seems to have left a log file, indicating failure: %s", jobFile)
logFile(getJobLogFileName(jobDir), logger.critical)
if os.path.isfile(jobFile):
job = Job.read(jobFile)
assert job not in updatedJobFiles
if resultStatus != 0 or newFilePresent or updatingFilePresent:
if not os.path.exists(job.getLogFileName()):
logger.critical("No log file is present, despite job failing: %s", jobFile)
setupJobAfterFailure(job, config)
if len(job.followOnCommands) > 0 or len(job.children) > 0:
updatedJobFiles.add(job) #Now we know the job is done we can add it to the list of updated job files
logger.debug("Added job: %s to active jobs" % jobFile)
else:
for message in job.messages: #This is here because jobs with no children or follow ons may log to master.
logger.critical("Got message from job at time: %s : %s" % (time.time(), message))
logger.debug("Job has no follow-ons or children despite job file being present so we'll consider it done: %s" % jobFile)
updateParentStatus(jobFile, updatedJobFiles, childJobFileToParentJob, childCounts)
else: #The job is done
if resultStatus != 0:
logger.critical("Despite the batch system claiming failure the job %s seems to have finished and been removed" % jobFile)
updateParentStatus(jobFile, updatedJobFiles, childJobFileToParentJob, childCounts)
示例2: _parseJobFiles
# 需要导入模块: from job import Job [as 别名]
# 或者: from job.Job import read [as 别名]
def _parseJobFiles(jobTreeJobsRoot, updatedJobFiles, childJobFileToParentJob, childCounts, config):
#Read job
job = Job.read(getJobFileName(jobTreeJobsRoot))
#Reset the job
job.messages = []
job.children = []
job.remainingRetryCount = int(config.attrib["try_count"])
#Get children
childJobs = reduce(lambda x,y:x+y, [ parseJobFiles(childDir, updatedJobFiles, childJobFileToParentJob, childCounts, config) for childDir in listChildDirs(jobTreeJobsRoot) ], [])
if len(childJobs) > 0:
childCounts[job] = len(childJobs)
for childJob in childJobs:
childJobFileToParentJob[childJob.getJobFileName()] = job
elif len(job.followOnCommands) > 0:
updatedJobFiles.add(job)
else: #Job is stub with nothing left to do, so ignore
return []
return [ job ]