<commit_before>namespace :maintenance do
  namespace :messages do
    
    desc "Regenerate message html"
    task :regenerate_html => :environment do
      Message.find_each(:batch_size => 100) do |m|
        m.auto_html_prepare
        m.save(false)
      end
    end
    
    desc "Save attachment height in the database"
    task :save_attachment_height => :environment do
      Message.with_image.find_in_batches(:batch_size => 100 ) do |messages|
        messages.each do |m|
          begin
            m.attachment_height = Paperclip::Geometry.from_file(m.attachment.path(:big)).height.to_i          
            m.save(false)
          rescue
            RAILS_DEFAULT_LOGGER.error "[ Maintenance ] There is a problem with the attachment #{m.id}"
          end
        end
      end
    end
    
  end
end<commit_msg>Add debug puts in rake task<commit_after>namespace :maintenance do
  namespace :messages do
    
    desc "Regenerate message html"
    task :regenerate_html => :environment do
      Message.find_each(:batch_size => 100) do |m|
        m.auto_html_prepare
        m.save(false)
      end
    end
    
    desc "Save attachment height in the database"
    task :save_attachment_height => :environment do
      Message.with_image.find_in_batches(:batch_size => 100 ) do |messages|
        messages.each do |m|
          begin
            m.attachment_height = Paperclip::Geometry.from_file(m.attachment.path(:big)).height.to_i          
            m.save(false)
            puts "#----------------------------------------------------------------------------"
            puts "#{m.attachment_height} px: #{m.attachment.path(:big)}"
            puts "#----------------------------------------------------------------------------"
          rescue
            RAILS_DEFAULT_LOGGER.error "[ Maintenance ] There is a problem with the attachment #{m.id}"
          end
        end
      end
    end
    
  end
end
{'fraction_non_alphanumeric': 0.15882048629073978, 'fraction_numerical': 0.006207966890843249, 'mean_word_length': 1.682385575589459, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1044960', 'n_tokens_mistral': 528, 'n_tokens_neox': 517, 'n_words': 132}