#312: added #logs action, search build_lists by arches && platforms

This commit is contained in:
Vokhmin Alexey V 2013-10-22 21:48:00 +04:00
parent 481828de66
commit 2ce16e805d
2 changed files with 14 additions and 1 deletions

View File

@ -8,8 +8,12 @@ class Api::V1::JobsController < Api::V1::BaseController
before_filter :authenticate_user!
def shift
platform_ids = Platform.where(name: params[:platforms].split(',')).pluck(:id) if params[:platforms].present?
arch_ids = Arch.where(name: params[:arches].split(',')).pluck(:id) if params[:arches].present?
ActiveRecord::Base.transaction do
build_lists = BuildList.for_status(BuildList::BUILD_PENDING).oldest.order(:created_at)
build_lists = BuildList.for_status(BuildList::BUILD_PENDING).scoped_to_arch(arch_ids).
oldest.order(:created_at)
build_lists = build_lists.for_platform(platform_ids) if platform_ids.present?
if current_user.system?
# TODO: rollback later
# @build_list = build_lists.not_owned_external_nodes.first
@ -42,6 +46,14 @@ class Api::V1::JobsController < Api::V1::BaseController
render :text => Resque.redis.get(params[:key])
end
def logs
name = params[:name]
if name =~ /abfworker::rpm-worker/
Resque.redis.setex name, 15, params[:logs]
end
render :nothing => true
end
def feedback
worker_queue = params[:worker_queue]
worker_class = params[:worker_class]

View File

@ -105,6 +105,7 @@ Rosa::Application.routes.draw do
get :shift
get :status
put :feedback
put :logs
end
end