<commit_before># frozen_string_literal: true

namespace :duplicate_jobs do
  desc "clear duplicated enqueued jobs"
  task clear: :environment do
    jobs = {}
    Sidekiq::Queue.all.each_with_object([]) do |queue, _array|
      queue.each do |job|
        key = "#{job.klass} #{job.args}"
        jobs[key] ||= []
        jobs[key] << job
      end
    end

    duplicated_jobs = jobs.select { |_k, v| v.size > 1 }.to_a
    deleted = 0
    duplicated_jobs.each do |_k, v|
      # keep the first, delete the other one
      v[1..-1].each do |job|<commit_msg>Unused params switch to each<commit_after># frozen_string_literal: true

namespace :duplicate_jobs do
  desc "clear duplicated enqueued jobs"
  task clear: :environment do
    jobs = {}
    Sidekiq::Queue.all.each do |queue|
      queue.each do |job|
        key = "#{job.klass} #{job.args}"
        jobs[key] ||= []
        jobs[key] << job
      end
    end

    duplicated_jobs = jobs.select { |_k, v| v.size > 1 }.to_a
    deleted = 0
    duplicated_jobs.each do |_k, v|
      # keep the first, delete the other one
      v[1..-1].each do |job|
{'fraction_non_alphanumeric': 0.12941176470588237, 'fraction_numerical': 0.007239819004524887, 'mean_word_length': 2.522292993630573, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1757101', 'n_tokens_mistral': 395, 'n_tokens_neox': 383, 'n_words': 110}