Sha256: e18d68ed4f14bbf3f5df9813363c95208f2322652ca28ed6635d21a8b6665cd7

Contents?: true

Size: 1.1 KB

Versions: 31

Compression:

Stored size: 1.1 KB

Contents

module Isomorfeus
  module Operation
    class DeferredTask < LucidObject
      STATES = %w[ready running failed]

      query :ready, 'state:"ready"'
      query :running, 'state:"running"'
      query :failed, 'state:"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: :yes, ensure: proc { |v| Isomorfeus::Operation::DeferredTask::STATES.include?(v) ? v : 'ready' }
      attribute :exception
      attribute :rtime

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

Version data entries

31 entries across 31 versions & 1 rubygems

Version Path
isomorfeus-operation-23.9.0.rc12 lib/isomorfeus/operation/deferred_task.rb
isomorfeus-operation-23.9.0.rc11 lib/isomorfeus/operation/deferred_task.rb
isomorfeus-operation-23.9.0.rc10 lib/isomorfeus/operation/deferred_task.rb
isomorfeus-operation-23.9.0.rc9 lib/isomorfeus/operation/deferred_task.rb
isomorfeus-operation-23.9.0.rc8 lib/isomorfeus/operation/deferred_task.rb
isomorfeus-operation-23.9.0.rc7 lib/isomorfeus/operation/deferred_task.rb
isomorfeus-operation-23.9.0.rc6 lib/isomorfeus/operation/deferred_task.rb
isomorfeus-operation-23.9.0.rc5 lib/isomorfeus/operation/deferred_task.rb
isomorfeus-operation-23.9.0.rc4 lib/isomorfeus/operation/deferred_task.rb
isomorfeus-operation-23.9.0.rc3 lib/isomorfeus/operation/deferred_task.rb
isomorfeus-operation-23.9.0.rc2 lib/isomorfeus/operation/deferred_task.rb
isomorfeus-operation-23.9.0.rc1 lib/isomorfeus/operation/deferred_task.rb
isomorfeus-operation-23.8.0.rc3 lib/isomorfeus/operation/deferred_task.rb
isomorfeus-operation-23.8.0.rc2 lib/isomorfeus/operation/deferred_task.rb
isomorfeus-operation-23.8.0.rc1 lib/isomorfeus/operation/deferred_task.rb
isomorfeus-operation-23.7.0.rc5 lib/isomorfeus/operation/deferred_task.rb
isomorfeus-operation-23.7.0.rc4 lib/isomorfeus/operation/deferred_task.rb
isomorfeus-operation-23.7.0.rc3 lib/isomorfeus/operation/deferred_task.rb
isomorfeus-operation-23.7.0.rc2 lib/isomorfeus/operation/deferred_task.rb
isomorfeus-operation-23.7.0.rc1 lib/isomorfeus/operation/deferred_task.rb