Skip to content

Commit

Permalink
Show progress during the process (#1461)
Browse files Browse the repository at this point in the history
* Show progress during the process

* change to count

* Ensure string added to array
  • Loading branch information
K8Sewell authored Dec 6, 2024
1 parent f50ee44 commit 87409e1
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions lib/tasks/load_lb_checksums.rake
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,14 @@ namespace :child_objects do
processed_child_objects_count = 0
child_objects_not_found = []
Dir[args[:files_glob]].each do |file|
Rails.logger.info("Number of child objects in file: #{File.read(file).each_line.count}")
line_count = File.read(file).each_line.count
Rails.logger.info("Number of child objects in file: #{line_count}")
open(file) do |f|
f.each do |line|
Rails.logger.info("Number of processed children: #{processed_child_objects_count}")
fields = Hash[headers.zip(line.strip.split("\t"))]
child_object = ChildObject.find_by(oid: fields['child_oid'])
child_objects_not_found << fields['child_oid'] if child_object.nil?
child_objects_not_found << fields['child_oid'].to_s if child_object.nil?
next unless child_object
child_object.md5_checksum = fields['md5']
child_object.sha256_checksum = fields['sha256']
Expand All @@ -22,7 +24,7 @@ namespace :child_objects do
end
end
Rails.logger.info("Number of child objects in files processed: #{processed_child_objects_count}")
Rails.logger.info("Number of child objects not found: #{child_objects_not_found.size}")
Rails.logger.info("Number of child objects not found: #{child_objects_not_found&.count}")
Rails.logger.info("OIDs of child objects not found: #{child_objects_not_found}")
end
end

0 comments on commit 87409e1

Please sign in to comment.