當前位置: 首頁>>代碼示例>>Python>>正文


Python PBSQuery.new_data_structure方法代碼示例

本文整理匯總了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
開發者ID:sysmso,項目名稱:sysadmin,代碼行數:29,代碼來源:pbscpu.py

示例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
開發者ID:ronanp,項目名稱:ClusterInterface,代碼行數:34,代碼來源:new_interface.py

示例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
開發者ID:sysmso,項目名稱:sysadmin,代碼行數:16,代碼來源:pbscpu.py

示例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
開發者ID:sysmso,項目名稱:sysadmin,代碼行數:26,代碼來源:clview.py


注:本文中的PBSQuery.PBSQuery.new_data_structure方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。