Modify

Opened 18 years ago

Closed 18 years ago

#3 closed defect (fixed)

.has_key does not work properly for getqueue items

Reported by: anonymous Owned by: bas
Priority: major Milestone:
Component: PBSQuery Version: 2.9.2
Keywords: Cc: bastiaans@…

Description

In [1]:import PBSQuery

In [2]:pq = PBSQuery.PBSQuery()

In [3]:q = pq.getqueue( 'q_express' )                          

In [4]:q
Out[4]:
{'q_express': q_express
        resources_default.nodect = 1
        resources_default.nodes = 1
        state_count = Transit:0 Queued:0 Held:0 Waiting:0 Running:0 Exiting:0 
        acl_host_enable = False
        resources_max.walltime = 00:05:00
        resources_assigned.nodect = 0
        acl_group_enable = False
        acl_user_enable = False
        enabled = True
        resources_max.nodect = 1
        started = True
        queue_type = Execution
        resources_default.ncpus = 1
        mtime = 1158756881
        resources_assigned.ncpus = 0
        total_jobs = 0
}

In [5]:dir( q['q_express'] )
Out[5]:
['FALSE',
 'TRUE',
 '__doc__',
 '__getitem__',
 '__init__',
 '__len__',
 '__module__',
 '__repr__',
 '__str__',
 'attribs',
 'get_value',
 'has_key',
 'is_enabled',
 'is_execution',
 'items',
 'keys',
 'name',
 'values']

In [6]:q['q_express'].has_key[ 'resources_default.walltime' ] 
---------------------------------------------------------------------------
exceptions.TypeError                                 Traceback (most recent call last)

/lisa_vg2_lv1/HOME/ramon/<console> 

TypeError: unsubscriptable object

In [7]:q['q_express']
Out[7]:
q_express
        resources_default.nodect = 1
        resources_default.nodes = 1
        state_count = Transit:0 Queued:0 Held:0 Waiting:0 Running:0 Exiting:0 
        acl_host_enable = False
        resources_max.walltime = 00:05:00
        resources_assigned.nodect = 0
        acl_group_enable = False
        acl_user_enable = False
        enabled = True
        resources_max.nodect = 1
        started = True
        queue_type = Execution
        resources_default.ncpus = 1
        mtime = 1158756881
        resources_assigned.ncpus = 0
        total_jobs = 0


In [8]:type( q['q_express'] )
Out[8]:<type 'instance'>

In [9]:type( q )             
Out[9]:<type 'dict'>

In [10]:

It appears the values in a getqueue attrs object are not seen as working dict's, thus has_key is not working.

Tested against:

ramon@testm:~$ apt-show-versions | grep pbs
pbs-python/sarge uptodate 2.9.2-2
ramon@testm:~$

Attachments (0)

Change History (6)

comment:1 Changed 18 years ago by anonymous

  • Component changed from pbs to PBSQuery

comment:2 Changed 18 years ago by bastiaans@…

  • Cc bastiaans@… removed

comment:3 Changed 18 years ago by anonymous

  • Cc bastiaans@… added

comment:4 Changed 18 years ago by anonymous

can't set my mail adress to reporter anymore :P

comment:5 Changed 18 years ago by bas

  • Cc basv@… removed
  • Owner changed from somebody to bas
  • Status changed from new to assigned

comment:6 Changed 18 years ago by bas

  • Resolution set to fixed
  • Status changed from assigned to closed

Fixed a bug in has_key() function for batch objects, must return 0 instead of None

Add Comment

Modify Ticket

Change Properties
Action
as closed The owner will remain bas.
The resolution will be deleted. Next status will be 'reopened'.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.