lib/right_chimp/daemon/ChimpDaemon.rb in right_chimp-2.1.10 vs lib/right_chimp/daemon/ChimpDaemon.rb in right_chimp-2.1.12

- old
+ new

@@ -197,10 +197,11 @@ # Trap signals to exit cleanly # def install_signal_handlers ['INT', 'TERM'].each do |signal| trap(signal) do + puts "Terminating..." self.quit end end end @@ -581,9 +582,37 @@ } end end resp.body = jobs.to_json + + raise WEBrick::HTTPStatus::OK + end + + # + # Attempt to return just 1 job data + # + if req.request_uri.path =~ /jobs\.json\/id\/*\w{6}$/ + + job_uid = File.basename(req.request_uri.path) + #instance the queue + queue = ChimpQueue.instance + + my_hash = {} + + #! Multiple servers WILL match for the same job_uuid + queue.group.each { |group| + #per each group, locate all jobs + group[1].get_jobs.each {|job| + my_hash[job.job_uuid] = { job.job_id => { "state" => job.results, + "server" => job.server.params["name"], + "audit_entry" => job.audit_entry_data, + } + } + } + } + + resp.body = my_hash[job_uid].to_json raise WEBrick::HTTPStatus::OK end