Skip to content

Instantly share code, notes, and snippets.

@pgwillia
Last active June 3, 2025 17:32
Show Gist options
  • Save pgwillia/89cd3a70427a78336c0c7f4105002983 to your computer and use it in GitHub Desktop.
Save pgwillia/89cd3a70427a78336c0c7f4105002983 to your computer and use it in GitHub Desktop.
Parsing PMPY preservation_event.json
# There are some example of scripts in /var/pushmi_pullyu/bin on middlesbrough. Can we do the same kind of thing on prod?
PushmiPullyu::AIP.create(uuid: <uuid>, type: 'items') do |aip_filename, aip_directory|
puts "HENRY: aip_filename=#{aip_filename}"
puts "HENRY: aip_directory=#{aip_directory}"
end
require 'csv'
CSV.open('failure.csv', 'wb') do |csv|
csv << ['event_time','entity_type','entity_uuid', 'error_message']
data.each do |datum|
csv << [datum['event_time'], datum['entity_type'], datum['entity_uuid'], datum['error_message']] if datum['event_type'] == "fail_and_retry" && datum['try_attempt'] == 16
end
end
require 'json'
file = File.read('./preservation_events_manipulated.json')
file.each_line do |line|
data << JSON.parse(line)
end
require 'csv'
CSV.open('success.csv', 'wb') do |csv|
csv << ['event_time','entity_type','entity_uuid']
data.each do |datum|
csv << [datum['event_time'], datum['entity_type'], datum['entity_uuid']] if datum['event_type'] == "success"
end
end
@pgwillia
Copy link
Author

pgwillia commented Jun 3, 2025

uuid error message
b470bdac-540b-4356-a796-eba1de754e6c Oops - not sure what happened: unexpected token at '

Request Entity Too Lar'

1b2e4301-26ff-4f57-8133-4b67e7a60857 Oops - not sure what happened: unexpected token at '

Request Entity Too Lar'

fae6573a-934c-4b60-93e6-38a7ea82651c No such file or directory @ rb_sysopen - tmp/work/fae6573a-934c-4b60-93e6-38a7ea82651c/data/logs/files_logs/2917cf0f-4998-45d1-a7f8-86d73e291c2a/content_fixity_report.n3
1d3a3d22-8dbd-4e31-99e5-8bfc51d4c401 PushmiPullyu::AIP::Creator::BagInvalid
b79488fe-4aef-47cb-8851-c9dd7ddc16f0 Oops - not sure what happened: unexpected token at '

Request Entity Too Lar'

79709757-2d2d-484e-90fa-798928726b13 Oops - not sure what happened: unexpected token at '

Request Entity Too Lar'

a28efd24-991d-4c19-bb9c-17113bf80b66 Oops - not sure what happened: unexpected token at '

Unprocessable Entity</'

fd73a07d-8be1-493d-a09d-e93ccc5cc1ae Oops - not sure what happened: unexpected token at '

Request Entity Too Lar'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment