class DRbQS::Worker::ForkedProcess

Public Instance Methods

calculate(marshal_obj, method_sym, args) click to toggle source
# File lib/drbqs/worker/forked_process.rb, line 64
def calculate(marshal_obj, method_sym, args)
  result = super(marshal_obj, method_sym, args)
  transfer_files = DRbQS::Transfer.dequeue_all
  { :result => result, :transfer => transfer_files }
end

Private Instance Methods

handle_task(obj) click to toggle source
# File lib/drbqs/worker/forked_process.rb, line 79
def handle_task(obj)
  task_id, marshal_obj, method_sym, args = obj
  DRbQS::Temporary.set_sub_directory(subdirectory_name(task_id))
  begin
    result_hash = calculate(marshal_obj, method_sym, args)
    # If task_id is nil then the task is initialization or finalization.
    # So we do not return results.
    if task_id
      if subdir = DRbQS::Temporary.subdirectory
        result_hash[:tmp] = subdir
      end
      result_hash[:id] = task_id
      send_response([:result, [task_id, result_hash]])
    end
  rescue => err
    send_response([:node_error, err])
  end
end
subdirectory_name(task_id) click to toggle source
# File lib/drbqs/worker/forked_process.rb, line 70
def subdirectory_name(task_id)
  if task_id
    sprintf("T%08d", task_id)
  else
    sprintf("S%08d", (@special_task_number += 1))
  end
end