Changeset 525 for trunk/jobmond/jobmond.py
- Timestamp:
- 03/19/08 10:48:11 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/jobmond/jobmond.py
r524 r525 1058 1058 # 1059 1059 class LsfDataGatherer(DataGatherer): 1060 1060 1061 """This is the DataGatherer for LSf""" 1061 1062 … … 1063 1064 1064 1065 def __init__( self ): 1066 1065 1067 self.jobs = { } 1066 1068 self.timeoffset = 0 … … 1068 1070 self.initLsfQuery() 1069 1071 1070 ######################## 1071 ## THIS IS TAKEN FROM 1072 ## http://bigbadcode.com/2007/04/04/count-the-duplicates-in-a-python-list/ 1073 from sets import Set 1074 # 1075 def _countDuplicatesInList(self,dupedList): 1076 uniqueSet = self.Set(item for item in dupedList) 1077 return [(item, dupedList.count(item)) for item in uniqueSet] 1072 def _countDuplicatesInList( self, dupedList ): 1073 1074 countDupes = { } 1075 1076 for item in dupedList: 1077 1078 if not countDupes.has_key( item ): 1079 1080 countDupes[ item ] = 1 1081 else: 1082 countDupes[ item ] = countDupes[ item ] + 1 1083 1084 dupeCountList = [ ] 1085 1086 for item, count in countDupes.items(): 1087 1088 dupeCountList.append( ( item, count ) ) 1089 1090 return dupeCountList 1078 1091 # 1079 1092 #lst = ['I1','I2','I1','I3','I4','I4','I7','I7','I7','I7','I7'] … … 1085 1098 self.pq = None 1086 1099 self.pq = lsfObject.jobInfoEntObject() 1087 1088 def getAttr( self, attrs, name ):1089 """Return certain attribute from dictionary, if exists"""1090 if attrs.has_key( name ):1091 return attrs[name]1092 else:1093 return ''1094 1100 1095 1101 def getJobData( self, known_jobs="" ): … … 1204 1210 jobs[ job_id ] = myAttrs 1205 1211 1206 #debug_msg( 10, printTime() + ' job %s state changed' %(job_id) )1212 debug_msg( 10, printTime() + ' job %s state changed' %(job_id) ) 1207 1213 1208 1214 for id, attrs in jobs.items(): 1209 1215 if id not in jobs_processed: 1210 # This one isn't there anymore ; toedeledoki!1216 # This one isn't there anymore 1211 1217 # 1212 1218 del jobs[ id ]
Note: See TracChangeset
for help on using the changeset viewer.