Skip to content

Instantly share code, notes, and snippets.

@cobbr2
Created February 23, 2018 23:53
Show Gist options
  • Save cobbr2/cc5771f4f15eb9b0f00573602765be99 to your computer and use it in GitHub Desktop.
Save cobbr2/cc5771f4f15eb9b0f00573602765be99 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
# Classifies a list of wfids into probably what workflow they come from,
# just based on the name.
require 'pp'
require 'set'
counters = Hash.new(0)
flows_per_kase = Hash.new(0)
wackies = Set.new
old_case_dates = Set.new
old_jp_dates = Set.new
STDIN.each_line do |line|
case line
when /^gr-.*-([[:xdigit:]]*$)/ then
counters[:pcp_workflows] += 1
counters[:kase_count] += flows_per_kase.has_key?($1) ? 0 : 1
flows_per_kase[$1] += 1
when /^[[:xdigit:]]+(-[[:xdigit:]]+){4,4}/ then
counters[:ingestion_workflows] += 1
when /^[[:xdigit:]]*$/ then
counters[:multipart_workflows] += 1
when /^([[:digit:]]{8,8})-[[:digit:]]{4,4}+-[a-z]+-[[:xdigit:]]+$/ then
counters[:old_cases] += 1
old_case_dates << $1.to_i
when /^([[:digit:]]{8,8})-[[:digit:]]{4,4}+-[a-z]+-[a-z]+$/ then
counters[:old_ruote_picked] += 1
old_jp_dates << $1.to_i
else
wackies << line
end
end
PP.pp counters
puts
puts "Wackys:"
PP.pp wackies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment