当前位置: 首页>>代码示例>>Python>>正文


Python PBSQuery.getqueues方法代码示例

本文整理汇总了Python中PBSQuery.PBSQuery.getqueues方法的典型用法代码示例。如果您正苦于以下问题:Python PBSQuery.getqueues方法的具体用法?Python PBSQuery.getqueues怎么用?Python PBSQuery.getqueues使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PBSQuery.PBSQuery的用法示例。


在下文中一共展示了PBSQuery.getqueues方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: main

# 需要导入模块: from PBSQuery import PBSQuery [as 别名]
# 或者: from PBSQuery.PBSQuery import getqueues [as 别名]
def main():
    pq = PBSQuery()
    queuedict = pq.getqueues()
    print queuedict
    for queuename, queue in sorted(queuedict.iteritems()):
        print queuename
        for k, v in queue.iteritems():
            print k, v
        print
开发者ID:prehensilecode,项目名称:qstatviewer,代码行数:11,代码来源:pqqueues.py

示例2: __init__

# 需要导入模块: from PBSQuery import PBSQuery [as 别名]
# 或者: from PBSQuery.PBSQuery import getqueues [as 别名]
  def __init__(self, server, verbosity=0, diagOutputFile=None):
    self.SRList = {}
    self.activeNodes = {}
    self.verbosity = verbosity
    self.server = server

    # Load Torque configuration
    
    try:
        torqueConfig=PBSQuery(server)
        self.server_info=torqueConfig.get_serverinfo()[server]
        self.nodes=torqueConfig.getnodes()
        self.queues=torqueConfig.getqueues()
    except PBSError, e:
        self.__debug(0,"Error connecting to PBS server: %s" % e)
        sys.exit(1)
开发者ID:GRIF,项目名称:lcg-info-dynamic-maui,代码行数:18,代码来源:TorqueMauiConfParser.py

示例3: getModelQueues

# 需要导入模块: from PBSQuery import PBSQuery [as 别名]
# 或者: from PBSQuery.PBSQuery import getqueues [as 别名]
    def getModelQueues(pbsServer):
        resultQueues = []
        pQuery = PBSQuery()

        try:
            queues = pQuery.getqueues()
            for queueName, pbsQueue in queues.items():
                customQueue = PBSQueue(server=pbsServer, name=queueName)
                try:
                    customQueue.type = TorqueService._listToStr(pbsQueue['queue_type'], '|')
                except KeyError:
                    pass
                try:
                    customQueue.total_jobs = TorqueService._listToInt(pbsQueue[pbs.ATTR_total])
                except KeyError:
                    pass
                try:
                    customQueue.running_jobs = int(TorqueService._strToDict(pbsQueue[pbs.ATTR_count][0])['Running'])
                except KeyError:
                    pass
                try:
                    customQueue.queued_jobs = int(TorqueService._strToDict(pbsQueue[pbs.ATTR_count][0])['Queued'])
                except KeyError:
                    pass
                try:
                    customQueue.resource_walltime = TorqueService._listToStr(pbsQueue[pbs.ATTR_rescdflt]['walltime'],
                        '|')
                except KeyError:
                    pass
                try:
                    customQueue.resource_nodes = TorqueService._listToInt(pbsQueue[pbs.ATTR_rescdflt]['nodes'])
                except KeyError:
                    pass

                resultQueues.append(customQueue)
        except PBSError as pbsErr:
            print(pbsErr)

        return resultQueues
开发者ID:dooodlesomething,项目名称:PyPBS,代码行数:41,代码来源:torque_service.py

示例4: int

# 需要导入模块: from PBSQuery import PBSQuery [as 别名]
# 或者: from PBSQuery.PBSQuery import getqueues [as 别名]
        for p in ['started', 'enabled', 'acl_group_enable']:
            if p in pbsqueue_dict:
                if pbsqueue_dict[p][0] == 'True':
                    self.__dict__[p] = True
                else:
                    self.__dict__[p] = False

        if 'state_count' in pbsqueue_dict:
            self.state_count = {}
            state_counts = pbsqueue_dict['state_count'][0].strip().split(' ')
            for s in state_counts:
                name, count = s.split(':')
                self.state_count[name] = int(count)



    def __str__(self):
        return str(self.__dict__)


if __name__ == '__main__':
    pq = PBSQuery()
    queues = {}
    for k,v in sorted(pq.getqueues().iteritems()):
        queues[k] = Queue(name=k, pbsqueue_dict=v)


    for queuename, queue in sorted(queues.iteritems()):
        print queuename, ':', queue

开发者ID:prehensilecode,项目名称:qstatviewer,代码行数:31,代码来源:Queue.py

示例5: nicer

# 需要导入模块: from PBSQuery import PBSQuery [as 别名]
# 或者: from PBSQuery.PBSQuery import getqueues [as 别名]
class QstatViewer:
    """
    Presents a nicer (?) interface to PBSQuery
    The two main member objects are:
    * jobs -- a dictionary with job ID (as str) as the key, 
              and the corresponding Job object as the value
    * nodes -- a dictionary with node name as the key, 
               and a set of corresponding job IDs (of jobs 
               running on node)
    """
    def __init__(self, pbs_server=None, debug_p=False):
        """Creates a QstatViewer object. Arguments:
           - pbs_server : FQDN of the TORQUE server to query (string)"""
        self.debug_p = debug_p

        self.nodes = {}
        self.jobs = {}
        self.queues = {}

        self.pbsquery = PBSQuery(pbs_server)

        self.servername = self.pbsquery.get_server_name()

        self.__make_server()
        self.__make_queues()
        self.__make_jobs()
        self.__make_nodes()


    def __make_nodes(self):
        """Make dict with node names as keys, and list of job objects as values"""

        # make list of jobids running on the node
        #node_jobs = {}
        #for jobid,job in self.jobs.iteritems():
        #    if job.exec_host:
        #        for node_cpu in job.exec_host:
        #            node = node_cpu.split('/')[0]
        #            if node not in node_jobs:
        #                node_jobs[node] = []
        #            else:
        #                node_jobs[node].append(jobid)

        rawnodes = self.pbsquery.getnodes()
        for n,s in rawnodes.iteritems():
            self.nodes[n] = Node(name=n, pbsnodes_dict=dict(s), debug_p=self.debug_p)


    def __make_jobs(self):
        """Make dict with job IDs as keys, and job properties as values"""
        rawjobs = self.pbsquery.getjobs()
        for j,p in rawjobs.iteritems():
            self.jobs[j] = Job(id=j, pbsjobs_dict=dict(p), debug_p=self.debug_p)

    def __make_queues(self):
        """make dict with queue names as keys, and queue properties as values"""
        rawqueues = self.pbsquery.getqueues()
        for q,p in rawqueues.iteritems():
            self.queues[q] = Queue(name=q, pbsqueue_dict=p)

    def __make_server(self):
        self.__serverinfo = self.pbsquery.get_serverinfo()[self.servername]
        if self.debug_p:
            print 'FOOBAR: self.serverinfo =', self.__serverinfo
        for k,v in self.__serverinfo.iteritems():
            self.__dict__[k] = None
            if k == 'state_count':
                # Example of state_count: Transit:0 Queued:-6458 Held:6383 Waiting:0 Running:964 Exiting:0
                self.__dict__[k] = {}
                vals = v[0].strip().split(' ')
                for state in vals:
                    statename = state.split(':')[0]
                    stateval  = int(state.split(':')[1])
                    self.__dict__[k][statename] = stateval
            elif k == 'resources_default':
                v['mem'] = Memory(v['mem'][0])
                v['pmem'] = Memory(v['pmem'][0])
                v['cput'] = pbstimestr_to_timedelta(v['cput'][0])
                v['walltime'] = pbstimestr_to_timedelta(v['walltime'][0])
                self.__dict__[k] = v
            elif k == 'resources_assigned':
                if 'mem' in v:
                    v['mem'] = Memory(v['mem'][0])

                if 'vmem' in v:
                    v['vmem'] = Memory(v['vmem'][0])

                if 'ncpus' in v:
                    v['ncpus'] = int(v['ncpus'][0])
                
                if 'nodect' in v:
                    v['nodect'] = int(v['nodect'][0])

                self.__dict__[k] = v
            elif k == 'scheduling' or k == 'query_other_jobs':
                if v[0] == 'True':
                    v[0] = True
                elif v[0] == 'False':
                    v[0] = False
                self.__dict__[k] = v[0]
#.........这里部分代码省略.........
开发者ID:prehensilecode,项目名称:qstatviewer,代码行数:103,代码来源:QstatViewer.py

示例6:

# 需要导入模块: from PBSQuery import PBSQuery [as 别名]
# 或者: from PBSQuery.PBSQuery import getqueues [as 别名]
#!/usr/bin/python

from PBSQuery import PBSQuery, PBSError
server = 'grid63.lal.in2p3.fr'

try:
    p=PBSQuery(server)
    pbs=p.get_serverinfo()
    nodes=p.getnodes()
    jobs=p.getjobs()
    queues=p.getqueues()
except PBSError, e:
    print "<h3>Error connecting to PBS server:</h3><tt>",e,"</tt>"
    sys.exit(1)


print ""
print "Server info:"
print pbs

print ""
print "Nodes:"
for node in nodes.keys():
  print "********** %s *********" % node
  print nodes[node]

print ""
print "Jobs:"
for job in jobs.keys():
  print "********** Job %s *********" % job
  print jobs[job]
开发者ID:GRIF,项目名称:lcg-info-dynamic-maui,代码行数:33,代码来源:test_pbs_python.py


注:本文中的PBSQuery.PBSQuery.getqueues方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。