<commit_before>require 'dm-core'
require 'dm-observer'
require 'dm-aggregates'

module DataMapper
  module Resource
    module ClassMethods
      def load_for_delayed_job(id)
        find!(id)
      end
    end

    module InstanceMethods
      def dump_for_delayed_job
        "#{self.class};#{id}"
      end
    end
  end
end

module Delayed
  module Backend
    module DataMapper
      class Job
        include ::DataMapper::Resource
        include Delayed::Backend::Base
        
        storage_names[:default] = 'delayed_jobs'
        
        property :id,          Serial
        property :priority,    Integer, :default => 0
        property :attempts,    Integer, :default => 0
        property :handler,     String
        property :run_at,      Time
        property :locked_at,   Time
        property :locked_by,   String
        property :failed_at,   Time
        property :last_error,  String
                
        def self.db_time_now
          Time.now.utc
        end
                
        def self.find_available(worker_name, limit = 5, max_run_time = Worker.max_run_time)
          <commit_msg>Use local time since DM ignores timezones<commit_after>require 'dm-core'
require 'dm-observer'
require 'dm-aggregates'

module DataMapper
  module Resource
    module ClassMethods
      def load_for_delayed_job(id)
        find!(id)
      end
    end

    module InstanceMethods
      def dump_for_delayed_job
        "#{self.class};#{id}"
      end
    end
  end
end

module Delayed
  module Backend
    module DataMapper
      class Job
        include ::DataMapper::Resource
        include Delayed::Backend::Base
        
        storage_names[:default] = 'delayed_jobs'
        
        property :id,          Serial
        property :priority,    Integer, :default => 0
        property :attempts,    Integer, :default => 0
        property :handler,     String
        property :run_at,      Time
        property :locked_at,   Time
        property :locked_by,   String
        property :failed_at,   Time
        property :last_error,  String
                
        def self.db_time_now
          Time.now
        end
                
        def self.find_available(worker_name, limit = 5, max_run_time = Worker.max_run_time)
          
{'fraction_non_alphanumeric': 0.0682218309859155, 'fraction_numerical': 0.002640845070422535, 'mean_word_length': 1.869949494949495, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, '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': '3291642', 'n_tokens_mistral': 655, 'n_tokens_neox': 641, 'n_words': 168}