Changeset 191 for trunk/daemon/togad.py


Ignore:
Timestamp:
08/09/05 10:44:07 (19 years ago)
Author:
bastiaans
Message:

daemon/togad.py:

  • Fixed the bugfix
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/daemon/togad.py

    r190 r191  
    154154                return result
    155155
     156        def getJobNodeId( self, job_id, node_id ):
     157
     158                id = self.getDatabase( "SELECT job_id,node_id FROM job_nodes WHERE job_id = '%s' AND node_id = '%s'" %(job_id, node_id) )
     159                if len( id ) > 0:
     160
     161                        if len( id[0] ) > 0 and id[0] != '':
     162                       
     163                                return 1
     164
     165                return 0
     166
    156167        def getNodeId( self, hostname ):
    157168
     
    237248                        elif valname == 'nodes' and value:
    238249
    239                                 node_invalid = 0
     250                                node_valid = 1
    240251
    241252                                if len(value) == 1:
    242253                               
    243                                         for node_char in str(value[0]):
    244 
    245                                                 if string.find( string.digits, node_char ) == -1:
    246 
    247                                                         node_invalid = 1
    248 
    249                                 if not node_invalid:
     254                                        if jobattrs['status'] == 'Q':
     255
     256                                                node_valid = 0
     257
     258                                        else:
     259
     260                                                node_valid = 0
     261
     262                                                for node_char in str(value[0]):
     263
     264                                                        if string.find( string.digits, node_char ) != -1 and not node_valid:
     265
     266                                                                node_valid = 1
     267
     268                                if node_valid:
    250269
    251270                                        ids = self.addNodes( value, jobattrs['domain'] )
    252271
    253                                 else:
    254                                         ids = [ ]
    255 
    256                                 node_list = value
    257 
    258272                if action == 'insert':
    259273
    260274                        self.setDatabase( "INSERT INTO jobs ( %s ) VALUES ( %s )" %( insert_col_str, insert_val_str ) )
    261275
    262                         if len( ids ) > 0:
    263                                 self.addJobNodes( job_id, ids )
    264 
    265276                elif action == 'update':
    266277
    267278                        self.setDatabase( "UPDATE jobs SET %s WHERE job_id=%s" %(update_str, job_id) )
    268279
    269                         if len( ids ) > 0:
    270                                 self.addJobNodes( job_id, ids )
     280                if len( ids ) > 0:
     281                        self.addJobNodes( job_id, ids )
    271282
    272283        def addNodes( self, hostnames, domain ):
     
    290301
    291302                for node in nodes:
    292                         self.addJobNode( jobid, node )
     303
     304                        if not self.getJobNodeId( jobid, node ):
     305
     306                                self.addJobNode( jobid, node )
    293307
    294308        def addJobNode( self, jobid, nodeid ):
Note: See TracChangeset for help on using the changeset viewer.