Changeset 166 for trunk/src


Ignore:
Timestamp:
10/07/08 16:57:53 (16 years ago)
Author:
sil
Message:

src/PBSQuery.py:

  • added function get_jobs() in node-class
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/PBSQuery.py

    r164 r166  
    8787                self.con = pbs.pbs_connect(self.server)
    8888                if self.con < 0:
    89                         str = "Could not make an connection with %s\n" %(self.server)
     89                        str = "Could not make a connection with %s\n" %(self.server)
    9090                        raise PBSError(str)
    9191
     
    9696
    9797        def _list_2_attrib(self, list):
    98                 """Convert an python list to an attrib list suitable for pbs"""
     98                """Convert a python list to an attrib list suitable for pbs"""
    9999                self.attribs = pbs.new_attrl( len(list) )
    100100                i = 0
     
    104104
    105105        def _pbsstr_2_list(self, str, delimiter):
    106                 """Convert an string to an python list and use delimiter as spit char"""
     106                """Convert a string to a python list and use delimiter as spit char"""
    107107                l = sting.splitfields(str, delimiter)
    108108                if len(l) > 1:
     
    110110
    111111        def _list_2_dict(self, l, class_func):
    112                 """Convert an pbsstat function list to an class dictionary"""
     112                """Convert a pbsstat function list to a class dictionary"""
    113113                self.d = {}
    114114                for item in l:
     
    266266                else:
    267267                        return self.FALSE
     268       
     269        def get_jobs(self, unique=None):
     270                """Returns a list of the currently running job-id('s) on the node"""
     271                jobs = self.get_value('jobs')
     272                if jobs:
     273                        re.compile('[^\\ /]\\d+[^/.]').findall( jobstring )
     274                        if not unique:
     275                                return jobs
     276                        else:
     277                                uniq = {}
     278                                for job in jobs:
     279                                        uniq[job] = 1
     280                                return uniq.keys()
     281                return list()
     282
     283
     284
     285
    268286
    269287class queue(_PBSobject):
Note: See TracChangeset for help on using the changeset viewer.