Changeset 191 for trunk/daemon/togad.py
- Timestamp:
- 08/09/05 10:44:07 (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/daemon/togad.py
r190 r191 154 154 return result 155 155 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 156 167 def getNodeId( self, hostname ): 157 168 … … 237 248 elif valname == 'nodes' and value: 238 249 239 node_ invalid = 0250 node_valid = 1 240 251 241 252 if len(value) == 1: 242 253 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: 250 269 251 270 ids = self.addNodes( value, jobattrs['domain'] ) 252 271 253 else:254 ids = [ ]255 256 node_list = value257 258 272 if action == 'insert': 259 273 260 274 self.setDatabase( "INSERT INTO jobs ( %s ) VALUES ( %s )" %( insert_col_str, insert_val_str ) ) 261 275 262 if len( ids ) > 0:263 self.addJobNodes( job_id, ids )264 265 276 elif action == 'update': 266 277 267 278 self.setDatabase( "UPDATE jobs SET %s WHERE job_id=%s" %(update_str, job_id) ) 268 279 269 270 280 if len( ids ) > 0: 281 self.addJobNodes( job_id, ids ) 271 282 272 283 def addNodes( self, hostnames, domain ): … … 290 301 291 302 for node in nodes: 292 self.addJobNode( jobid, node ) 303 304 if not self.getJobNodeId( jobid, node ): 305 306 self.addJobNode( jobid, node ) 293 307 294 308 def addJobNode( self, jobid, nodeid ):
Note: See TracChangeset
for help on using the changeset viewer.