def status(dependency=nil, ret_reply=true)
reply = ResultIO.new
app_status = []
tag = ""
handle = RemoteJob.create_parallel_job
self.comp_instance_map.each do |comp_inst_name, comp_inst|
next if !dependency.nil? and (comp_inst.parent_cart_name != dependency)
next if comp_inst.parent_cart_name == self.name
group_inst = self.group_instance_map[comp_inst.group_instance_name]
group_inst.gears.each do |gear|
job = gear.status_job(comp_inst)
RemoteJob.add_parallel_job(handle, tag, gear, job)
end
end
if RemoteJob.has_jobs(handle)
RemoteJob.run_parallel_on_gears([], handle) { }
RemoteJob.get_parallel_run_results(handle) { |tag, gear, output, rc|
if rc != 0
Rails.logger.error "Error: Getting '#{dependency}' status from gear '#{gear}', errcode: '#{rc}' and output: #{output}"
raise OpenShift::UserException.new("Error: Getting '#{dependency}' status from gear '#{gear}', errcode: '#{rc}' and output: #{output}", 143)
else
r = ResultIO.new
r.resultIO << output
reply.append r
app_status.push({"gear_id" => gear, "message" => output}) unless ret_reply
end
}
end
if ret_reply
return reply
else
return app_status
end
end