<commit_before>namespace :om do
  desc "Fetch data for all cafeterias"
  task :fetch => :environment do
    Rails.logger.info "[#{Time.zone.now}] Fetch canteen data..."
    date = Time.zone.now.to_date

    Canteen.all.each do |canteen|
      next if canteen.last_fetched_at and canteen.last_fetched_at.to_date == date
      next if Time.zone.now.hour < canteen.fetch_hour

      begin
        canteen.fetch
      rescue
        Rails.logger.warn "Error while fetching canteen data of #{canteen.id}: #{canteen.name}"
      end
    end
  end
end
<commit_msg>task: om:fetch - print error message on catched exception<commit_after>namespace :om do
  desc "Fetch data for all cafeterias"
  task :fetch => :environment do
    Rails.logger.info "[#{Time.zone.now}] Fetch canteen data..."
    date = Time.zone.now.to_date

    Canteen.all.each do |canteen|
      next if canteen.last_fetched_at and canteen.last_fetched_at.to_date == date
      next if Time.zone.now.hour < canteen.fetch_hour

      begin
        canteen.fetch
      rescue => e
        Rails.logger.warn "Error while fetching canteen data of #{canteen.id} (#{canteen.name}): #{e.message}"
      end
    end
  end
end

{'fraction_non_alphanumeric': 0.10441426146010187, 'fraction_numerical': 0.0, 'mean_word_length': 2.8279220779220777, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 6, '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': '4579748', 'n_tokens_mistral': 400, 'n_tokens_neox': 407, 'n_words': 107}