Class: Isono::NodeModules::JobCollector::Dispatch

Inherits:
Object
  • Object
show all
Defined in:
lib/isono/node_modules/job_collector.rb

Instance Method Summary collapse

Instance Method Details

#call(req, res) ⇒ Object



26
27
28
29
30
31
32
33
34
# File 'lib/isono/node_modules/job_collector.rb', line 26

def call(req, res)
  @req, @res = req, res
  raise Rack::UnknownMethodError if @req.command == 'call'
  m = self.method(@req.command)
  raise Rack::UnknownMethodError if m.nil?

  ret = m.call
  @res.response(nil)  if @res.responded?
end

#recordObject



19
20
21
22
23
24
# File 'lib/isono/node_modules/job_collector.rb', line 19

def record
  params = @req.args[0]
  params[:node_id]=@req.sender
  job =Models::JobState.find_or_create(:job_id=>params[:job_id])
  job.set_fields(params, [:parent_job_id, :session_id, :node_id, :state, :started_at, :finished_at, :job_name]).save_changes
end