<commit_before># frozen_string_literal: true

require 'trinity/influxdb'

namespace :influxdb do
  db_name = Trinity::InfluxDB.configuration.influxdb_database
  RPS = [
    %(create retention policy "default" on "#{db_name}" duration 24h REPLICATION 1 DEFAULT;),
    %(create retention policy "an_hour" on "#{db_name}" duration 1h REPLICATION 1;),
    %(create retention policy "a_month" on "#{db_name}" duration 30d REPLICATION 1;),
    %(create retention policy "a_year" on "#{db_name}" duration 52w REPLICATION 1;)
  ].freeze

  desc "Configure query and retention policy"
  task setup: :environment do
    client = Trinity::InfluxDB.client
    RPS.each do |q|
      client.query q
    end
  end

  desc "Create influxdb database"
  task create_db: :environment do
    Trinity::InfluxDB.create_db!
  end
end<commit_msg>Infuxdb rake task style<commit_after># frozen_string_literal: true

require 'trinity/influxdb'

namespace :influxdb do
  db_name = Trinity::InfluxDB.configuration.influxdb_database
  RPS = [
    %(create retention policy "default" on "#{db_name}" duration 24h REPLICATION 1 DEFAULT;),
    %(create retention policy "an_hour" on "#{db_name}" duration 1h REPLICATION 1;),
    %(create retention policy "a_month" on "#{db_name}" duration 30d REPLICATION 1;),
    %(create retention policy "a_year" on "#{db_name}" duration 52w REPLICATION 1;)
  ].freeze

  desc 'Configure query and retention policy'
  task setup: :environment do
    client = Trinity::InfluxDB.client
    RPS.each do |q|
      client.query q
    end
  end

  desc 'Create influxdb database'
  task create_db: :environment do
    Trinity::InfluxDB.create_db!
  end
end
{'fraction_non_alphanumeric': 0.10278113663845223, 'fraction_numerical': 0.013301088270858524, 'mean_word_length': 4.30448717948718, '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': '3590141', 'n_tokens_mistral': 585, 'n_tokens_neox': 520, 'n_words': 168}