本文整理汇总了Python中PBSQuery.PBSQuery.getqueue方法的典型用法代码示例。如果您正苦于以下问题:Python PBSQuery.getqueue方法的具体用法?Python PBSQuery.getqueue怎么用?Python PBSQuery.getqueue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PBSQuery.PBSQuery
的用法示例。
在下文中一共展示了PBSQuery.getqueue方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: PBSManager
# 需要导入模块: from PBSQuery import PBSQuery [as 别名]
# 或者: from PBSQuery.PBSQuery import getqueue [as 别名]
class PBSManager():
def __init__(self):
self.p = PBSQuery()
self.queue = self.p.getqueue(survey)
self.jobs = self.p.getjobs()
self.nodes = self.p.getnodes_with_property(use_ressources)
self.queue_names = self.jobs.keys()
#print self.nodes
#print self.nodes['psr13']['ncpus']
def jobs_running(self):
queue_status = self.queue['state_count'][0]
Transit, Queued, Held, Waiting, Running, Exiting = queue_status.split()
Queued = int(Queued.split(':')[1])
Running = int(Running.split(':')[1])
return Running, Queued
def is_running(self, basefilename):
jobnames = []
for jobs_name in self.queue_names:
job_info = self.jobs[jobs_name]
jobnames.append(job_info["Job_Name"][0])
return (basefilename in jobnames)
def get_stderr_path(self, basefilename):
stderr_path = os.path.join(logs_loc, "%s.err"%(basefilename))
if not os.path.exists(stderr_path):
raise ValueError("Cannot find error log for job (%s): %s" % \
(basefilename, stderr_path))
return stderr_path
def had_errors(self, basefilename):
try:
errorlog = self.get_stderr_path(basefilename)
except ValueError:
errors = False
else:
if os.path.getsize(errorlog) > 0:
errors = True
else:
errors = False
return errors
def get_errors(self, basefilename):
try:
errorlog = self.get_stderr_path(basefilename)
except ValueError, e:
errors = str(e)
else: