Class: Skynet::AsyncJob

Inherits:
Job
  • Object
show all
Defined in:
lib/skynet/skynet_job.rb,
lib/skynet/skynet_tuplespace_server.rb

Constant Summary

Constants inherited from Job

Job::FIELDS

Instance Attribute Summary

Attributes inherited from Job

#data_debug, #use_local_queue

Instance Method Summary collapse

Methods inherited from Job

#async?, #data_debug?, debug_class_desc, #display_info, #enqueue_messages, #gather_results, #keep_map_tasks, #keep_reduce_tasks, #local_master?, #local_mq, #local_mq_reset!, #map_data=, #map_enqueue, #map_local?, #map_reduce_class=, #map_results, #map_retry, #map_tasks, #master?, #master_enqueue, #master_results, #master_retry, #master_task, mq, #mq, #partition_data, #reduce_enqueue, #reduce_local?, #reduce_results, #reduce_retry, #reduce_tasks, #reset!, #results, results_by_job_id, #run, #run_master, #single?, #solo?, #start_after=, #task_id, #tasks_to_messages, #to_h, #use_local_queue?, #version, #version=

Methods included from GuidGenerator

#get_unique_id

Methods included from SkynetDebugger

#args_pp, #debug, #debug_header, #error, #fatal, included, #info, #log, #printlog, #stderr, #stdout, #warn

Constructor Details

#initialize(options = {}) ⇒ AsyncJob

Skynet::AsyncJob is for Skynet jobs you want to run asyncronously. Normally when you run a Skynet::Job it blocks until the job is complete. Running an Async job merely returns a job_id which can be used later to retrieve the results. See Skynet::Job for full documentation



740
741
742
743
744
# File 'lib/skynet/skynet_job.rb', line 740

def initialize(options = {})
  options[:async]        = true
  options[:local_master] = false
  super(options)      
end

Instance Method Details

#map=(klass) ⇒ Object



746
747
748
749
750
751
# File 'lib/skynet/skynet_job.rb', line 746

def map=(klass)
  unless klass.class == String or klass.class == Class
    raise BadMapOrReduceError.new("#{self.class}.map only accepts a class name") 
  end
  @map = klass.to_s
end

#reduce=(klass) ⇒ Object



753
754
755
756
757
758
# File 'lib/skynet/skynet_job.rb', line 753

def reduce=(klass)
  unless klass.class == String or klass.class == Class
    raise BadMapOrReduceError.new("#{self.class}.reduce only accepts a class name") 
  end
  @reduce = klass.to_s
end