Class: DRbQS::Test::Node

Inherits:
Node
  • Object
show all
Defined in:
lib/drbqs/server/test/node.rb

Constant Summary

Constants inherited from Node

Node::DEFAULT_LOG_FILE, Node::INTERVAL_TIME_DEFAULT, Node::MAX_WORKER_WAIT_TIME, Node::OUTPUT_NOT_SEND_RESULT, Node::PRIORITY_CALCULATE, Node::PRIORITY_RESPOND, Node::SAME_HOST_GROUP, Node::WAIT_NEW_TASK_TIME, Node::WORKER_WAIT_INTERVAL

Instance Method Summary collapse

Methods inherited from Node

#calculate, #connect, #set_signal_trap

Constructor Details

#initialize(log_level, transfer, queue) ⇒ Node

Returns a new instance of Node.



6
7
8
9
10
11
# File 'lib/drbqs/server/test/node.rb', line 6

def initialize(log_level, transfer, queue)
  super(nil, :log_file => $stdout, :log_level => log_level)
  DRbQS::Transfer::Client.set(transfer.get_client(true)) if transfer
  @task_client = DRbQS::Node::TaskClient.new(nil, queue, nil, [DRbQS::Node::SAME_HOST_GROUP], 1)
  @special_task_number = 0
end

Instance Method Details

#calcObject



39
40
41
42
43
44
45
46
# File 'lib/drbqs/server/test/node.rb', line 39

def calc
  if ary = @task_client.get_task
    task_id, marshal_obj, method_sym, args = ary
    result = execute_task(task_id, marshal_obj, method_sym, args)
    return [task_id, result]
  end
  nil
end

#finalize(finalization_task_ary) ⇒ Object



48
49
50
51
52
53
54
55
56
# File 'lib/drbqs/server/test/node.rb', line 48

def finalize(finalization_task_ary)
  if finalization_task_ary
    finalization_task_ary.each do |task|
      args = task.simple_drb_args
      execute_task(nil, *args)
    end
  end
  clear_node_files
end

#server_on_same_host?Boolean

Returns:

  • (Boolean)


13
14
15
# File 'lib/drbqs/server/test/node.rb', line 13

def server_on_same_host?
  true
end