<commit_before>require 'yaml'
require 'thread'
require 'securerandom'
require 'shellwords'

task :install_dbms => :install_essentials do
  if PARAMS.manage_database_system?
    log_notice "Installing database server software..."
    type = APP_CONFIG.database_type

    on roles(:db) do |host|
      case host.properties.fetch(:os_class)
      when :redhat
        case type
        when 'postgresql'
          # TODO: install hstore (maybe in some contrib package)
          yum_install(host, %w(postgresql postgresql-server))
          files = sudo_capture(host, "ls -1 /var/lib/pgsql/data")
          if files.empty?
            sudo(host, "service postgresql initdb")
          end
          if !sudo_test(host, "service postgresql status")
            sudo(host, "service postgresql start")
            # Wait for PostgreSQL to start.
            sleep 1
          end
        else
          abort "Unsupported database type. Only PostgreSQL is supported."
        end
      when :debian
        case type
        when 'postgresql'
          apt_get_install(host, %w(postgresql postgresql-contrib postgresql-client))
        else
          abort "Unsupported database type. Only PostgreSQL is supported."
        end
      else
        raise "Bug"
      end<commit_msg>Install postgresql-contrib on Red Hat systems<commit_after>require 'yaml'
require 'thread'
require 'securerandom'
require 'shellwords'

task :install_dbms => :install_essentials do
  if PARAMS.manage_database_system?
    log_notice "Installing database server software..."
    type = APP_CONFIG.database_type

    on roles(:db) do |host|
      case host.properties.fetch(:os_class)
      when :redhat
        case type
        when 'postgresql'
          yum_install(host, %w(postgresql postgresql-server postgresql-contrib))
          files = sudo_capture(host, "ls -1 /var/lib/pgsql/data")
          if files.empty?
            sudo(host, "service postgresql initdb")
          end
          if !sudo_test(host, "service postgresql status")
            sudo(host, "service postgresql start")
            # Wait for PostgreSQL to start.
            sleep 1
          end
        else
          abort "Unsupported database type. Only PostgreSQL is supported."
        end
      when :debian
        case type
        when 'postgresql'
          apt_get_install(host, %w(postgresql postgresql-contrib postgresql-client))
        else
          abort "Unsupported database type. Only PostgreSQL is supported."
        end
      else
        raise "Bug"
      end
{'fraction_non_alphanumeric': 0.07813733228097869, 'fraction_numerical': 0.0015785319652722968, 'mean_word_length': 2.2251908396946565, 'pattern_counts': {'":': 0, '<': 3, '<?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': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2955441', 'n_tokens_mistral': 735, 'n_tokens_neox': 717, 'n_words': 211}