Class: Wakame::Command::Actor

Inherits:
Object
  • Object
show all
Includes:
Wakame::Command, Service
Defined in:
lib/wakame/command/actor.rb

Constant Summary

Constants included from Service

Service::Property, Service::STATUS_ENTERING, Service::STATUS_FAIL, Service::STATUS_INIT, Service::STATUS_MIGRATING, Service::STATUS_OFFLINE, Service::STATUS_ONLINE, Service::STATUS_QUITTING, Service::STATUS_RELOADING, Service::STATUS_STARTING, Service::STATUS_STOPPING, Service::STATUS_TERMINATE, Service::STATUS_UNKNOWN

Instance Method Summary collapse

Methods included from Wakame::Command

included, #options=, #params

Instance Method Details

#parse(args) ⇒ Object



8
9
10
# File 'lib/wakame/command/actor.rb', line 8

def parse(args)
  raise "Not enugh number of arguments" if args.size < 2
end

#runObject



12
13
14
15
16
17
18
19
20
21
# File 'lib/wakame/command/actor.rb', line 12

def run
  agent = Agent.find(params[:agent_id])
  raise "Unknown agent: #{params[:agent_id]}" if agent.nil?
  raise "Invalid agent status (Not Online): #{agent.status} #{params[:agent_id]}" if agent.status != Agent::STATUS_ONLINE

  raise "Invalid actor path: #{params[:path]}" if params[:path].nil? || params[:path] == ''

  request = rule.master.actor_request(params[:agent_id], params[:path], *params[:args]).request
  request.wait
end