本文整理汇总了Python中PBSQuery.PBSQuery.new_data_structure方法的典型用法代码示例。如果您正苦于以下问题:Python PBSQuery.new_data_structure方法的具体用法?Python PBSQuery.new_data_structure怎么用?Python PBSQuery.new_data_structure使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PBSQuery.PBSQuery
的用法示例。
在下文中一共展示了PBSQuery.new_data_structure方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: countppn
# 需要导入模块: from PBSQuery import PBSQuery [as 别名]
# 或者: from PBSQuery.PBSQuery import new_data_structure [as 别名]
def countppn(queue):
p = PBSQuery()
p.new_data_structure()
jobs = p.getjobs()
nptot = 0
for id in jobs:
try:
if jobs[id].queue[0] == queue and jobs[id].job_state[0] == 'R':
np = jobs[id].Resource_List.nodes
if 'ppn' not in np[0]:
np = 1
else:
npptot = 0
ct = [m.start() for m in re.finditer('ppn', np[0])]
for val in ct:
char = np[0]
vals = val+4
valf = val+6
npp = char[vals:valf]
npp = re.sub('[[email protected]#+:$]', '', npp)
npp = int(npp)
npptot = npp + npptot
np = npptot
nptot = np + nptot
except PBSError, detail:
print detail
pass
示例2: main
# 需要导入模块: from PBSQuery import PBSQuery [as 别名]
# 或者: from PBSQuery.PBSQuery import new_data_structure [as 别名]
def main():
p = PBSQuery()
p.new_data_structure()
#job = p.getjob('2983215')
#print job['substate']
#print job.substate
#print job.queue
#print job.Resource_List
#print job.Resource_List.nodes
#print job.Resource_List.arch
#print job.Variable_List.PBS_O_HOME
l = ['np', 'state' ]
node = p.getnode("gb-r5n1", l)
print node.name, node['np']
sys.exit(0)
#nodes = p.getnodes(l)
for id in nodes:
print id
try:
print nodes[id].np
print nodes[id].status.arch
print nodes[id].status.uname
print nodes[id].state
except PBSError, detail:
print detail
pass
示例3: countcpu
# 需要导入模块: from PBSQuery import PBSQuery [as 别名]
# 或者: from PBSQuery.PBSQuery import new_data_structure [as 别名]
def countcpu(queue):
p = PBSQuery()
p.new_data_structure()
nodes = p.getnodes()
nptot = 0
for id in nodes:
if nodes[id].properties == [queue]:
try:
np = nodes[id].np
np = int(np[0])
nptot = nptot + np
except PBSError, detail:
print detail
pass
示例4: main
# 需要导入模块: from PBSQuery import PBSQuery [as 别名]
# 或者: from PBSQuery.PBSQuery import new_data_structure [as 别名]
def main():
p = PBSQuery()
p.new_data_structure()
nodes = p.getnodes()
l=list()
for id in nodes:
try:
queue = nodes[id].properties[0]
state = nodes[id].state[0]
power = nodes[id].power_state[0]
np = nodes[id].np[0]
name = nodes[id].name
if hasattr(nodes[id],"jobs"):
jobs = nodes[id].jobs[0].split('/')
if len(jobs) > 1:
jobs = jobs[1]
else:
jobs = jobs[0]
else:
jobs = "none"
l.append([name,state,power,queue,np,jobs])
except PBSError, detail:
print detail
pass