Changeset 2194
- Timestamp:
- 06/22/09 12:53:43 (1 year ago)
- Files:
-
- hive/trunk/data_webapp/lib/tasks/collector.rake (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
hive/trunk/data_webapp/lib/tasks/collector.rake
r2125 r2194 23 23 end 24 24 25 # Given millis from the Epoch convert it to 26 # the String version of a Date 27 def _microseconds_to_string(value) 28 return value unless value.is_a?(BigDecimal) 29 f = value.to_s 30 a = f.split(".") 31 t = Time.at(a[0].to_f) 32 t.strftime("%Y-%m-%d %H:%M:%S.#{a[1]} %Z") 33 end 34 private :_microseconds_to_string 35 25 36 # Gets all nested attributes that correspond to foreign keys in this object. 26 37 def _get_nested_attributes(object) … … 62 73 63 74 # Clean up the client timestamps. 64 data[key]["created_at"] = microseconds_to_string(BigDecimal.new(data[key]["start"].to_s))75 data[key]["created_at"] = _microseconds_to_string(BigDecimal.new(data[key]["start"].to_s)) 65 76 data[key].delete("start") 66 77 if (!data[key]["compromise"].nil?) 67 data[key]["suspended_at"] = microseconds_to_string(BigDecimal.new(data[key]["compromise"].to_s))78 data[key]["suspended_at"] = _microseconds_to_string(BigDecimal.new(data[key]["compromise"].to_s)) 68 79 end 69 80 data[key].delete("compromise") … … 236 247 237 248 messages = [] 238 offset = 3249 offset = 0 239 250 #offset = 0 240 251 #limit = 1000 … … 243 254 print "\n" 244 255 STDOUT.flush 245 while (objects.size > 0) && (offset < 4)do256 while (objects.size > 0) do 246 257 print objects.first.id.to_s + ".." 247 258 STDOUT.flush … … 321 332 # Get a list of all compromised clients. 322 333 clients = Client.find(:all, :conditions => {:status => "compromised"}) 323 client = clients[63]324 334 clients.each do |client| 325 335 print client.id.to_s + ".."
