Sha256: 6f04d5ee516f9bc239d048e8c892d67d8135f794f3f0dad53db34a892b07419b

Contents?: true

Size: 1.02 KB

Versions: 5

Compression:

Stored size: 1.02 KB

Contents

module Isomorfeus
  module Operation
    class DailyTask < LucidObject::Base
      STATES = %w[ready running failed]
      # when the task is added to the queue its added as ready
      # when its running, its running
      # when it failes, it failed, the exception attribute is filled
      # when it was successful, its removed from the queue
      attribute :operation_class_name, class: String, required: true, validate_block: proc { |v| raise 'Invalid Operation class!' unless Isomorfeus.valid_operation_class_name?(v) }
      attribute :props
      attribute :user_class_name, class: String, default: 'Anonymous'
      attribute :user_key, class: String, default: 'anonymous'
      attribute :state, class: String, required: true, index: :value, ensure: proc { |v| Isomorfeus::Operation::DailyTask::STATES.include?(v) ? v : 'ready' }
      attribute :exception
      attribute :rtime
      attribute :fail, default: true

      def get_exception
        Marshal.load(exception) if exception
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
isomorfeus-operation-2.4.2 lib/isomorfeus/operation/daily_task.rb
isomorfeus-operation-2.4.1 lib/isomorfeus/operation/daily_task.rb
isomorfeus-operation-2.4.0 lib/isomorfeus/operation/daily_task.rb
isomorfeus-operation-2.3.1 lib/isomorfeus/operation/daily_task.rb
isomorfeus-operation-2.3.0 lib/isomorfeus/operation/daily_task.rb