<commit_before>module Atmopshere
  module Clockwork
    extend ActiveSupport::Concern

    included do
      every(1.minute, 'monitoring.templates') do
        Atmosphere::ComputeSite.active.select(:id, :name).each do |cs|
          Rails.logger.debug "Creating templates monitoring task for #{cs.name}"
          Atmosphere::VmTemplateMonitoringWorker.perform_async(cs.id)
        end
      end

      every(30.seconds, 'monitoring.vms') do
        Atmosphere::ComputeSite.active.select(:id, :name).each do |cs|
          Rails.logger.debug "Creating vms monitoring task for #{cs.name}"
          Atmosphere::VmMonitoringWorker.perform_async(cs.id)
        end
      end

      every(Atmosphere.monitoring.query_interval.minutes, 'monitoring.load') do
        Atmosphere::VmLoadMonitoringWorker.perform_async
      end

      every(120.minutes, 'monitoring.flavors') do
        Atmosphere::FlavorWorker.perform_async
      end

      every(60.minutes, 'billing.bill') do
        Atmosphere::BillingWorker.perform_async
      end

      every(Atmosphere.url_monitoring.pending.seconds, 'monitoring.http_mappings.pending') do
        Atmosphere::HttpMappingMonitoringWorker.perform_async(:pending)
      end

      every(Atmosphere.url_monitoring.ok.seconds, 'monitoring.http_mappings.ok') do
        Atmosphere::HttpMappingMonitoringWorker.perform_async(:ok)
      end

      every(Atmosphere.url_monitoring.lost.seconds, 'monitoring.http_mappings.lost') do
        Atmosphere::HttpMappingMonitoringWorker.perform_async(:lost)
      end
    end
  end
end<commit_msg>similar behaviour moved into separate method<commit_after>module Atmopshere
  module Clockwork
    extend ActiveSupport::Concern

    included do
      every(1.minute, 'monitoring.templates') do
        action_on_actice_cses('templates monitoring',
                              Atmosphere::VmTemplateMonitoringWorker)
      end

      every(30.seconds, 'monitoring.vms') do
        action_on_actice_cses('vms monitoring',
                              Atmosphere::VmMonitoringWorker)
      end

      every(Atmosphere.monitoring.query_interval.minutes, 'monitoring.load') do
        Atmosphere::VmLoadMonitoringWorker.perform_async
      end

      every(120.minutes, 'monitoring.flavors') do
        Atmosphere::FlavorWorker.perform_async
      end

      every(60.minutes, 'billing.bill') do
        Atmosphere::BillingWorker.perform_async
      end

      every(Atmosphere.url_monitoring.pending.seconds,
            'monitoring.http_mappings.pending') do
        Atmosphere::HttpMappingMonitoringWorker.perform_async(:pending)
      end

      every(Atmosphere.url_monitoring.ok.seconds,
            'monitoring.http_mappings.ok') do
        Atmosphere::HttpMappingMonitoringWorker.perform_async(:ok)
      end

      every(Atmosphere.url_monitoring.lost.seconds,
            'monitoring.http_mappings.lost') do
        Atmosphere::HttpMappingMonitoringWorker.perform_async(:lost)
      end

      def self.action_on_actice_cses(name, task)
        Atmosphere::ComputeSite.active.select(:id, :name).each do |cs|
          Rails.logger.debug "Creating #{name} task for #{cs.name}"
          task.perform_async(cs.id)
        end
      end
    end
  end
end
{'fraction_non_alphanumeric': 0.09144451332920024, 'fraction_numerical': 0.0049597024178549285, 'mean_word_length': 2.9839506172839507, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '1654272', 'n_tokens_mistral': 995, 'n_tokens_neox': 948, 'n_words': 150}