<commit_before># @author <NAME> <<EMAIL>>
Capistrano::Configuration.instance(true).load do

  namespace :logrotate do
    set(:logrotate_path) { shared_path }
    set :logrotate_dir, 'log'
    set :logrotate_keep_logs, 10
    set :logrotate_symlink_to_path, nil # like ephemeral volumes /mnt/logs/#{application}

    def log_dir(num)
      File.join(logrotate_path, num == 0 ? logrotate_dir : "#{logrotate_dir}.#{num.to_s}")
    end

    def symlink_dir(num)
      File.join(logrotate_symlink_to_path, num == 0 ? logrotate_dir : "#{logrotate_dir}.#{num.to_s}")
    end

    def make_log_dir(num)
      if logrotate_symlink_to_path
        # TODO if log_dir not a symlink move it before doing anything
        run "mkdir -p #{symlink_dir(num)}"
        run "ln -sf #{symlink_dir(num)} #{log_dir(num)}"
        run "mv #{symlink_dir(num)} #{symlink_dir(num+1)}" unless num == 0
      else
        run "mkdir -p #{log_dir(num)}"
        run "mv #{log_dir(num)} #{log_dir(num+1)}" unless num == 0
      end
    end

    def del_log_dir(num)
      if logrotate_symlink_to_path
        run "rm #{log_dir(num)}"
        run "rm -rf #{symlink_dir(num)}"
      else 
        run "rm -rf #{log_dir(num)}"
      end
    end

    desc "rotate the log directory"
    task :rotate, :except => { :no_release => true } do
      run "mkdir -p #{logrotate_path}"
      if logrotate_symlink_to_path
        run "#{sudo} mkdir -p #{logrotate_symlink_to_path}; chown -R #{user}:#{user} #{logrotate_symlink_to_path}"
      end
      (0..logrotate_keep_logs).to_a.reverse.each do |num|
        make_log_dir(num)
      end
      make_log_dir(0)
      del_log_dir(logrotate_keep_logs+1)
    end

  end
end<commit_msg>Revert "allow an option to symlink the log directories somewhere else"<commit_after># @author <NAME> <<EMAIL>>
Capistrano::Configuration.instance(true).load do

  namespace :logrotate do
    set(:logrotate_path) { shared_path }
    set :logrotate_dir, 'log'
    set :logrotate_keep_logs, 10

    def log_dir(num)
      File.join(logrotate_path, num == 0 ? logrotate_dir : "#{logrotate_dir}.#{num.to_s}")
    end

    desc "rotate the log directory"
    task :rotate, :except => { :no_release => true } do
      (0..logrotate_keep_logs).to_a.reverse.each do |num|
        run "mkdir -p #{log_dir(num)}; mv #{log_dir(num)} #{log_dir(num+1)}"
      end
      run "mkdir -p #{log_dir(0)}"
      run "rm -rf #{log_dir(logrotate_keep_logs+1)}"
    end

  end
end
{'fraction_non_alphanumeric': 0.1343954248366013, 'fraction_numerical': 0.007352941176470588, 'mean_word_length': 3.102177554438861, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 13, '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': '1678747', 'n_tokens_mistral': 905, 'n_tokens_neox': 885, 'n_words': 207}