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


Python Job.qtime方法代码示例

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


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

示例1: getJobs

# 需要导入模块: from Job import Job [as 别名]
# 或者: from Job.Job import qtime [as 别名]
    def getJobs(self):
        self.numCpusInUse = 0
        #p = PBSQuery.PBSQuery()

        #jobslist = p.getjobs()

        jobslist = pbs.pbs_statjob(self.con, "", "NULL", "NULL")
        for jobInst in jobslist:
            job = Job(jobInst.name)
            #print "name is"+jobInst.name+"text is",jobInst.text,"next is",jobInst.next,"and this is",jobInst.this
            for attrib in jobInst.attribs:
                #print attrib.name+" is the name and the value is "+attrib.value
                if attrib.name == 'Resource_List':
                    if attrib.resource == "nodes":  #Value corresponding to nodes is in format (nodes=)X:ppn=Y[:property1[:propertyN]]
                            #value is an array of one item
                            if ":" in attrib.value:    #Node data may be colon separated with procs per node and node properties
                                #print "value for nodes is %s" % attrib.value
                                #nodes,ppnstring = attrib.value.split(":")

                                nodeDataList = attrib.value.split(":")
                                job.numNodes = int(nodeDataList[0])
                                iterNum = 0     ##Needed to iterate through our properies and skip the first one.
                                for item in nodeDataList:
                                    if "=" in item:         #An equals suggests a nodes= or ppn= assignment
                                        label,value = item.split("=")
                                        if label == 'ppn':
                                            job.ppn = int(value)
                                        ##No else, as it would match the walltime entry!
                                    else:       #No equals sign means this is a property
                                        if iterNum > 0: ##unless its the num_nodes int we stripped off earlier!
                                            job.properties.append(item)
                                            #If node has a "cloud" property, its cloud, else hardware

                                    iterNum += 1
                            else:   #ppn not specified so is taken to be one
                                job.numNodes = int(attrib.value)
                                job.ppn = 1
                                job.ncpus = job.numNodes
                    elif attrib.resource == "walltime":
                        job.walltime = attrib.value
                    elif attrib.resource == "nodect":
                        job.nodect = attrib.value
                    else:
                        print "attrib resource is %s" % attrib.resource
                elif attrib.name == 'qtime':
                    job.qtime = int(attrib.value)
                elif attrib.name == 'job_state':
                    if attrib.value == 'Q':
                        job.status = 'queued'
                        self.queuedJobs.append(job)
                    elif attrib.value == 'R':
                        job.status = 'running'
                        self.numCpusInUse += job.ncpus
                    else:
                        job.status = 'other'    #We are not interested in complete or errored jobs.
                else:
                    pass
                    #print "Attrib name is %s and value is %s" % (attrib.name, attrib.value)
            ##Now we have acquired all the information we need from each job. Store the job
            # data in our self.jobs array
            job.ncpus = job.numNodes * job.ppn
            self.jobs.append(job)
        self.numJobs = len(self.jobs)
        self.numQueuedJobs = len(self.queuedJobs)
开发者ID:ronanp,项目名称:ClusterInterface,代码行数:66,代码来源:TorqueDriver.py


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