<commit_before>require 'clockwork'
#require_relative 'environment' # preload Rails

module Clockwork
  configure do |config|
    config[:sleep_timeout] = 30
  end

  handler do |job_name|
    pid = fork do
      # postload Rails
      require_relative 'application'
      Nvst::Application.configure do
        config.eager_load = false
        initialize!
      end

      job_name = job_name.gsub /(_job)?$/, '_job'
      job_class = job_name.camelize.constantize
      job_class.perform
    end

    Process.detach pid
  end

  every 1.hour, 'db_backup', at: '**:00'
  every 1.day,  'populate_investments', at: '22:00', if: ->(t) { (1..5).include? t.wday }
end<commit_msg>Simplified clockwork job invocation<commit_after>require 'clockwork'
#require_relative 'environment' # preload Rails

module Clockwork
  configure do |config|
    config[:sleep_timeout] = 30
  end

  handler do |job_name|
    pid = fork do
      # postload Rails
      require_relative 'application'
      Nvst::Application.configure do
        config.eager_load = false
        initialize!
      end

      Job.run(job_name)
    end

    Process.detach pid
  end

  every 1.hour, 'db_backup', at: '**:00'
  every 1.day,  'populate_investments', at: '22:00', if: ->(t) { (1..5).include? t.wday }
end
{'fraction_non_alphanumeric': 0.1130298273155416, 'fraction_numerical': 0.018838304552590265, 'mean_word_length': 2.9473684210526314, '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': '190044', 'n_tokens_mistral': 452, 'n_tokens_neox': 420, 'n_words': 108}