本文整理匯總了Python中PBSQuery.PBSQuery.getnodes_with_property方法的典型用法代碼示例。如果您正苦於以下問題:Python PBSQuery.getnodes_with_property方法的具體用法?Python PBSQuery.getnodes_with_property怎麽用?Python PBSQuery.getnodes_with_property使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類PBSQuery.PBSQuery
的用法示例。
在下文中一共展示了PBSQuery.getnodes_with_property方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: PBSManager
# 需要導入模塊: from PBSQuery import PBSQuery [as 別名]
# 或者: from PBSQuery.PBSQuery import getnodes_with_property [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: