#843: update pages for using only new_core

This commit is contained in:
Vokhmin Alexey V 2013-01-21 19:52:20 +04:00
parent c46cc31ff5
commit 86034c5da4
9 changed files with 42 additions and 47 deletions

View File

@ -31,11 +31,7 @@ class Projects::BuildListsController < Projects::BaseController
@build_lists = BuildList.where(:id => @bls.pluck("#{BuildList.table_name}.id")).recent
@build_lists = @build_lists.includes [:save_to_platform, :save_to_repository, :arch, :user, :project => [:owner]]
@build_server_status = begin
BuildServer.get_status
rescue Exception # Timeout::Error
{}
end
@build_server_status = AbfWorker::StatusInspector.get_status
end
def new

View File

@ -45,7 +45,7 @@ class BuildList < ActiveRecord::Base
attr_accessible :include_repos, :auto_publish, :build_for_platform_id, :commit_hash,
:arch_id, :project_id, :save_to_repository_id, :update_type,
:save_to_platform_id, :new_core, :project_version
:save_to_platform_id, :project_version
LIVE_TIME = 4.week # for unpublished
MAX_LIVE_TIME = 3.month # for published

View File

@ -17,9 +17,6 @@
.both.bottom_20
= check_box_tag :auto_publish, true, @auto_publish_selected, :id => 'auto_publish'
= label_tag :auto_publish, t('activerecord.attributes.build_list.auto_publish')
%br
= check_box_tag :new_core, true, false
= label_tag :new_core, t('activerecord.attributes.build_list.new_core')
%br
%br

View File

@ -2,19 +2,16 @@
.bordered.nopadding
%h3= t('layout.build_lists.build_server_status.header')
.table
.lefter= t('layout.build_lists.build_server_status.client_count')
.righter= @build_server_status['client_count']
.both
.table
.lefter= t('layout.build_lists.build_server_status.count_new_task')
.righter= @build_server_status['count_new_task']
.both
.table
.lefter= t('layout.build_lists.build_server_status.count_build_task')
.righter= @build_server_status['count_build_task']
.both
%br
- [:rpm, :publish].each do |queue|
.table
.lefter= t("layout.build_lists.build_server_status.#{queue}_workers")
.both
- [:count, :tasks, :build_tasks].each do |metric|
.table
.lefter= t("layout.build_lists.build_server_status.#{metric}")
.righter= @build_server_status[queue][metric]
.both
%br
= link_to t('layout.build_lists.new_header'), new_project_build_list_path(@project), :class => 'button' if @project and can?(:create, @project.build_lists.build)
= form_for :filter, :url => @action_url, :html => { :method => :post, :class => :form } do |f|

View File

@ -26,9 +26,6 @@
.both
= f.check_box :auto_publish
= f.label :auto_publish
.both
= f.check_box :new_core
= f.label :new_core
%br
= f.submit t("layout.projects.build_button")

View File

@ -88,9 +88,11 @@ en:
build_server_status:
header: Build server status
client_count: Number of clients
count_new_task: Number of tasks in queue
count_build_task: Number of tasks in execution
count: '- count'
tasks: '- tasks in queue'
build_tasks: '- tasks in execution'
rpm_workers: Workers for building
publish_workers: Workers for publishing
items:
statuses:

View File

@ -85,9 +85,11 @@ ru:
build_server_status:
header: Статус сборочного сервера
client_count: Число клиентов
count_new_task: Число заданий в очереди
count_build_task: Число выполняемых заданий
count: '- число'
tasks: '- заданий в очереди'
build_tasks: '- заданий выполняется'
rpm_workers: Воркеров для сборки
publish_workers: Воркеров для публикации
items:
statuses:

View File

@ -0,0 +1,20 @@
module AbfWorker
class StatusInspector
def self.get_status
redis, all_workers = Resque.redis, Resque.workers
status = {}
[:rpm, :publish].each do |worker|
workers = all_workers.select{ |w| w.to_s =~ /#{worker}_worker_default/ }
key = "queue:#{worker}_worker"
status[worker] = {
:count => workers.count,
:build_tasks => workers.select{ |w| w.working? }.count,
:tasks => (redis.llen("#{key}_default") + redis.llen(key))
}
end
status
end
end
end

View File

@ -280,22 +280,6 @@ describe Projects::BuildListsController do
end
context 'for admin' do
before(:each) { set_session_for FactoryGirl.create(:admin) }
it "should be able to perform index action without exception" do
any_instance_of(XMLRPC::Client) do |xml_rpc|
stub(xml_rpc).call do |args|
raise Timeout::Error
end
end
get :index
assigns[:build_server_status].should == {}
response.should be_success
end
end
end
context 'filter' do
before(:each) do