Changeset 245


Ignore:
Timestamp:
08/13/10 15:06:59 (14 years ago)
Author:
bas
Message:

Some improvements on get_jobs for node class

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/CHANGES

    r244 r245  
    2121     - fixed and error in get_jobs function for nodes. Did not
    2222       support new data structure and uniq did not work.
    23        Authors: Shunjie Lau <eijnuhs at gmail dot com> and Bas van der Vlie
     23       Authors: Shunjie Lau <eijnuhs at gmail dot com> and Bas van der Vlies
    2424
    2525=========== 4.1.0
  • trunk/src/PBSQuery.py

    r243 r245  
    437437                jobs = self.get_value('jobs')
    438438                if jobs:       
    439                         if type(jobs) == type('string') :
    440                                 jobs = re.compile('[^\\ /]\\d+[^/.]').findall( jobs )
     439                        if isinstance(jobs, str):
     440                                jlist = re.compile('[^\\ /]\\d+[^/.]').findall( jobs )
    441441                       
    442                         if not unique:
    443                                 return jobs
     442                                if not unique:
     443                                        return jlist
     444                                else:
     445                                        return self.uniq(jlist)
     446
    444447                        else:
    445448                                job_re = re.compile('^(?:\d+/)?(.+)')
    446449                                l = list()
    447450
    448                                 for j in jobs:
    449                                     jobstr = job_re.findall(j.strip())[0]
    450                                     if jobstr not in l:
    451                                         l.append(jobstr)           
    452                                 return l
     451                                if unique:
     452                                                for j in jobs:
     453                                                        jobstr = job_re.findall(j.strip())[0]
     454                                                if jobstr not in l:
     455                                                        l.append(jobstr)           
     456
     457                                                return l
     458                                else:
     459                                                return jobs
    453460
    454461                return list()
Note: See TracChangeset for help on using the changeset viewer.