Changeset 661 for trunk/jobmond
- Timestamp:
- 09/04/12 11:23:16 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/jobmond/jobmond.py
r660 r661 289 289 except ConfigParser.NoOptionError: 290 290 291 # Not specified: assume /etc/g mond.conf291 # Not specified: assume /etc/ganglia/gmond.conf 292 292 # 293 GMOND_CONF = '/etc/g mond.conf'293 GMOND_CONF = '/etc/ganglia/gmond.conf' 294 294 295 295 ganglia_cfg = GangliaConfigParser( GMOND_CONF ) … … 881 881 882 882 # Abstracted from PBS original. 883 # Fixme: Is it worth (or appropriate for PBS) sorting the result?884 883 # 885 884 def do_nodelist( nodes ): … … 1232 1231 job_id = name.split( '.' )[0] 1233 1232 1233 owner = self.getAttr( attrs, 'Job_Owner' ) 1234 1234 name = self.getAttr( attrs, 'Job_Name' ) 1235 1235 queue = self.getAttr( attrs, 'queue' ) 1236 1237 if QUEUE: 1238 for q in QUEUE: 1239 if q == queue: 1240 display_queue = 1 1241 break 1242 else: 1243 display_queue = 0 1244 continue 1245 if display_queue == 0: 1246 continue 1247 1248 1249 owner = self.getAttr( attrs, 'Job_Owner' ).split( '@' )[0] 1236 nodect = self.getAttr( attrs['nodes'], 'nodect' ) 1237 exec_group = self.getAttr( attrs, 'egroup' ) 1238 1250 1239 requested_time = self.getAttr( attrs['Resource_List'], 'walltime' ) 1251 1240 requested_memory = self.getAttr( attrs['Resource_List'], 'mem' ) 1252 1241 1242 1243 requested_nodes = '' 1253 1244 mynoderequest = self.getAttr( attrs['Resource_List'], 'nodes' ) 1254 1245 1255 1246 ppn = '' 1256 1257 if mynoderequest.find( ':' ) != -1 and mynoderequest.find( 'ppn' ) != -1: 1247 attributes = '' 1248 1249 if mynoderequest.find( ':' ) != -1: 1258 1250 1259 1251 mynoderequest_fields = mynoderequest.split( ':' ) … … 1261 1253 for mynoderequest_field in mynoderequest_fields: 1262 1254 1255 if mynoderequest_field.isdigit(): 1256 1257 continue #TODO add requested_nodes if is hostname(s) 1258 1263 1259 if mynoderequest_field.find( 'ppn' ) != -1: 1264 1260 1265 1261 ppn = mynoderequest_field.split( 'ppn=' )[1] 1266 1262 1263 else: 1264 1265 if attributes == '': 1266 1267 attributes = '%s' %mynoderequest_field 1268 else: 1269 attributes = '%s:%s' %( attributes, mynoderequest_field ) 1270 1267 1271 status = self.getAttr( attrs, 'job_state' ) 1268 1272 1269 if status in [ 'Q', 'R' ]:1273 if status in [ 'Q', 'R', 'W' ]: 1270 1274 1271 1275 jobs_processed.append( job_id ) 1272 1276 1273 queued_timestamp = self.getAttr( attrs, 'ctime' ) 1277 create_timestamp = self.getAttr( attrs, 'ctime' ) 1278 running_nodes = '' 1279 exec_nodestr = '' 1274 1280 1275 1281 if status == 'R': 1276 1282 1277 start_timestamp = self.getAttr( attrs, 'mtime' ) 1278 nodes = self.getAttr( attrs, 'exec_host' ).split( '+' ) 1279 1283 #start_timestamp = self.getAttr( attrs, 'etime' ) 1284 start_timestamp = self.getAttr( attrs, 'start_time' ) 1285 exec_nodestr = self.getAttr( attrs, 'exec_host' ) 1286 1287 nodes = exec_nodestr.split( '+' ) 1280 1288 nodeslist = do_nodelist( nodes ) 1289 running_nodes = string.join( nodeslist, ' ' ) 1281 1290 1282 1291 if DETECT_TIME_DIFFS: … … 1306 1315 start_timestamp = '' 1307 1316 count_mynodes = 0 1317 1318 queued_timestamp = self.getAttr( attrs, 'qtime' ) 1308 1319 1309 1320 for node in mynoderequest.split( '+' ): … … 1358 1369 myAttrs = { } 1359 1370 1360 myAttrs[ 'name' ] = str( name ) 1361 myAttrs[ 'queue' ] = str( queue ) 1362 myAttrs[ 'owner' ] = str( owner ) 1363 myAttrs[ 'requested_time' ] = str( requested_time ) 1364 myAttrs[ 'requested_memory' ] = str( requested_memory ) 1365 myAttrs[ 'ppn' ] = str( ppn ) 1366 myAttrs[ 'status' ] = str( status ) 1367 myAttrs[ 'start_timestamp' ] = str( start_timestamp ) 1368 myAttrs[ 'queued_timestamp' ] = str( queued_timestamp ) 1369 myAttrs[ 'reported' ] = str( int( int( self.cur_time ) + int( self.timeoffset ) ) ) 1370 myAttrs[ 'nodes' ] = nodeslist 1371 myAttrs[ 'domain' ] = fqdn_parts( socket.getfqdn() )[1] 1372 myAttrs[ 'poll_interval' ] = str( BATCH_POLL_INTERVAL ) 1373 1374 if self.jobDataChanged( self.jobs, job_id, myAttrs ) and myAttrs['status'] in [ 'R', 'Q' ]: 1371 myAttrs[ 'name' ] = str( name ) 1372 myAttrs[ 'status' ] = str( status ) 1373 myAttrs[ 'queue' ] = str( queue ) 1374 myAttrs[ 'owner' ] = str( owner ) 1375 myAttrs[ 'nodect' ] = str( nodect ) 1376 myAttrs[ 'exec.group' ] = str( exec_group ) 1377 myAttrs[ 'exec.hostnames' ] = str( running_nodes ) 1378 myAttrs[ 'exec.nodestr' ] = str( exec_nodestr ) 1379 myAttrs[ 'req.walltime' ] = str( requested_time ) 1380 myAttrs[ 'req.memory' ] = str( requested_memory ) 1381 myAttrs[ 'req.nodes' ] = str( requested_nodes ) 1382 myAttrs[ 'req.ppn' ] = str( ppn ) 1383 myAttrs[ 'req.attributes' ] = str( attributes ) 1384 myAttrs[ 'timestamp.running' ] = str( start_timestamp ) 1385 myAttrs[ 'timestamp.created' ] = str( create_timestamp ) 1386 myAttrs[ 'timestamp.queued' ] = str( queued_timestamp ) 1387 1388 if self.jobDataChanged( self.jobs, job_id, myAttrs ) and myAttrs['status'] in [ 'R', 'Q', 'W' ]: 1375 1389 1376 1390 self.jobs[ job_id ] = myAttrs
Note: See TracChangeset
for help on using the changeset viewer.