<commit_before># coding: UTF-8

namespace :cartodb do
  namespace :common_data do
    desc 'Generates datasets assets and upload them to Amazon S3'
    task :generate_s3_assets, [:all_public] => :environment do |t, args|
      all_public = args[:all_public].blank? ? false : args[:all_public]
      common_data = CommonData.new
      common_data.assets_to_upload(all_public) { |asset|
        url = CommonData.upload_to_s3("#{asset[:table_name]}.zip", asset[:body])
        puts "#{asset[:table_name]} was uploaded to #{url}"
      }
    end
  end
end
<commit_msg>Adds retries to rake task<commit_after># coding: UTF-8

namespace :cartodb do
  namespace :common_data do
    desc 'Generates datasets assets and upload them to Amazon S3'
    task :generate_s3_assets, [:all_public] => :environment do |t, args|
      all_public = args[:all_public].blank? ? false : args[:all_public]
      common_data = CommonData.new
      common_data.assets_to_upload(all_public) { |asset|
        body = asset[:body][]
        retries = 0
        begin
          retries += 1
          url = CommonData.upload_to_s3("#{asset[:table_name]}.zip", body)
          puts "#{asset[:table_name]} was uploaded to #{url}"
        rescue
          if retries >= 3
            puts "#{asset[:table_name]} failed to upload. Updating "
            common_data.update_table_metadata(asset[:table_name])
          else
            sleep 5
            retry
          end
        end
      }
    end
  end
end

{'fraction_non_alphanumeric': 0.10893098782138025, 'fraction_numerical': 0.008119079837618403, 'mean_word_length': 2.6791044776119404, 'pattern_counts': {'":': 0, '<': 3, '<?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': '7527046', 'n_tokens_mistral': 464, 'n_tokens_neox': 458, 'n_words': 120}