447 nodes in this job analysis
Average Agent Run time:
206.4653 seconds
or
3.441 minutes
######################
Maximum Run Time:
1111
or
18.5166 minutes
######################
Earliest Start Time: 2020-07-28T03:07:23-04:00
Latest Start Time: 2020-07-28T03:13:46-04:00
Difference of:
383 seconds
or
6.3833 minutes
Last active
July 30, 2020 19:00
-
-
Save trlinkin/4bdc2a30e24e5315b7e7d88a760cb438 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'json' | |
require 'time' | |
times_file = ARGV[0] | |
if File.file?(times_file) | |
times = JSON.parse(File.read(times_file)) | |
else | |
puts "The argument provided was is either incorrect or not a file." | |
exit 1 | |
end | |
starts = [] | |
node_count = 0 | |
times.map! do |time| | |
node_count += 1 | |
start_time = Time.iso8601(time['start_time']).to_i | |
end_time = Time.iso8601(time['end_time']).to_i | |
starts << start_time.to_i | |
(end_time.to_i - start_time.to_i) | |
end | |
puts "#{node_count} nodes in this job analysis" | |
puts "Average Agent Run time:" | |
avg_times = times.inject{ |sum, el| sum + el }.to_f / times.size | |
puts "#{avg_times.truncate(4)} seconds" | |
puts "or" | |
puts "#{(avg_times / 60).truncate(4)} minutes" | |
puts "######################" | |
puts "Maximum Run Time:" | |
puts times.max | |
puts 'or' | |
puts "#{(times.max.to_f / 60).truncate(4)} minutes" | |
puts "######################" | |
puts "Earliest Start Time: " + Time.at(starts.min).iso8601 | |
puts "Latest Start Time: " + Time.at(starts.max).iso8601 | |
time_diff = (starts.max - starts.min) | |
puts "Difference of: " | |
puts "#{time_diff.truncate(4)} seconds" | |
puts "or" | |
puts "#{(time_diff.to_f / 60).truncate(4)} minutes" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment