Readd status panel
This commit is contained in:
parent
74313e2369
commit
8cbe33ab0a
|
@ -68,6 +68,7 @@ function($scope, BuildListsService, $location, $interval, $uibModal) {
|
||||||
$scope.total_items = res.total_items;
|
$scope.total_items = res.total_items;
|
||||||
$location.search(Object.assign(filter, res.filter));
|
$location.search(Object.assign(filter, res.filter));
|
||||||
$scope.per_page = filter.per_page;
|
$scope.per_page = filter.per_page;
|
||||||
|
$scope.server_status = res.server_status;
|
||||||
$scope.isRequest = false;
|
$scope.isRequest = false;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -138,7 +139,6 @@ function($scope, BuildListsService, $location, $interval, $uibModal) {
|
||||||
|
|
||||||
RosaABF.controller('FiltersInstanceController', ['$scope', '$uibModalInstance', 'params',
|
RosaABF.controller('FiltersInstanceController', ['$scope', '$uibModalInstance', 'params',
|
||||||
function($scope, $uibModalInstance, params) {
|
function($scope, $uibModalInstance, params) {
|
||||||
console.log(params);
|
|
||||||
$scope.params = params;
|
$scope.params = params;
|
||||||
|
|
||||||
$scope.apply = function() {
|
$scope.apply = function() {
|
||||||
|
|
|
@ -65,7 +65,7 @@ RosaABF.controller 'StatisticsController', ['$scope', '$http', '$timeout', ($sco
|
||||||
range_end: $scope.range_end
|
range_end: $scope.range_end
|
||||||
users_or_groups: $scope.users_or_groups
|
users_or_groups: $scope.users_or_groups
|
||||||
format: 'json'
|
format: 'json'
|
||||||
console.log($scope.users_or_groups)
|
|
||||||
$http.get($scope.statistics_path, params: params).success (results) ->
|
$http.get($scope.statistics_path, params: params).success (results) ->
|
||||||
$scope.statistics = results
|
$scope.statistics = results
|
||||||
|
|
||||||
|
|
|
@ -37,7 +37,6 @@ var BuildList = function(atts, dictionary) {
|
||||||
self.version_link_url = Routes.commit_path(self.project.name_with_owner, self.version_link_text);
|
self.version_link_url = Routes.commit_path(self.project.name_with_owner, self.version_link_text);
|
||||||
}
|
}
|
||||||
self.project.url = Routes.project_build_lists_path(self.project.name_with_owner);
|
self.project.url = Routes.project_build_lists_path(self.project.name_with_owner);
|
||||||
console.log(self.project.url);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (self.user)
|
if (self.user)
|
||||||
|
|
|
@ -68,7 +68,8 @@ angular.module("RosaABF").factory('BuildListsService', ["$http", function($http)
|
||||||
build_lists: build_lists_final,
|
build_lists: build_lists_final,
|
||||||
page: results.data.page,
|
page: results.data.page,
|
||||||
total_items: results.data.total_items,
|
total_items: results.data.total_items,
|
||||||
filter: results.data.filter
|
filter: results.data.filter,
|
||||||
|
server_status: results.data.server_status
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,7 +35,7 @@ class Projects::BuildListsController < Projects::BaseController
|
||||||
:source_packages,
|
:source_packages,
|
||||||
project: :project_statistics)
|
project: :project_statistics)
|
||||||
|
|
||||||
#@build_server_status = AbfWorkerStatusPresenter.new.projects_status
|
@build_server_status = AbfWorkerStatusPresenter.new.projects_status
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -69,7 +69,7 @@ class Projects::ProjectsController < Projects::BaseController
|
||||||
|
|
||||||
if @project.save
|
if @project.save
|
||||||
flash[:notice] = t('flash.project.saved')
|
flash[:notice] = t('flash.project.saved')
|
||||||
redirect_to @project
|
redirect_to project_build_lists_path(@project)
|
||||||
else
|
else
|
||||||
flash[:error] = t('flash.project.save_error')
|
flash[:error] = t('flash.project.save_error')
|
||||||
flash[:warning] = @project.errors.full_messages.join('. ')
|
flash[:warning] = @project.errors.full_messages.join('. ')
|
||||||
|
|
|
@ -4,56 +4,21 @@ class AbfWorkerStatusPresenter
|
||||||
end
|
end
|
||||||
|
|
||||||
def projects_status
|
def projects_status
|
||||||
Rails.cache.fetch([AbfWorkerStatusPresenter, :projects_status], expires_in: 10.seconds) do
|
Rails.cache.fetch([AbfWorkerStatusPresenter, :projects_status], expires_in: 30.seconds) do
|
||||||
result = get_status(:rpm, :publish) { |w, worker| w.to_s =~ /#{worker}_worker_default/ }
|
result = {rpm: {}}
|
||||||
nodes = RpmBuildNode.total_statistics
|
nodes = RpmBuildNode.total_statistics
|
||||||
result[:rpm][:workers] += nodes[:systems]
|
result[:rpm][:workers] = nodes[:systems]
|
||||||
result[:rpm][:build_tasks] += nodes[:busy]
|
result[:rpm][:build_tasks] = nodes[:busy]
|
||||||
result[:rpm][:other_workers] = nodes[:others]
|
result[:rpm][:other_workers] = nodes[:others]
|
||||||
|
|
||||||
external_bls = BuildList.for_status(BuildList::BUILD_PENDING).external_nodes(:everything).count
|
normal_pending = BuildList.for_status(BuildList::BUILD_PENDING).where(mass_build_id: nil).count
|
||||||
result[:rpm][:default_tasks] += external_bls + count_of_tasks('user_build_')
|
mass_build_pending = BuildList.for_status(BuildList::BUILD_PENDING).where.not(mass_build_id: nil).count
|
||||||
|
|
||||||
|
result[:rpm][:pending] = normal_pending
|
||||||
|
result[:rpm][:mass_build_pending] = mass_build_pending
|
||||||
|
|
||||||
mass_build_tasks = count_of_tasks('mass_build_')
|
|
||||||
result[:rpm][:low_tasks] += mass_build_tasks
|
|
||||||
result[:rpm][:tasks] += external_bls + mass_build_tasks
|
|
||||||
result
|
result
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def products_status
|
|
||||||
get_status(:iso) { |w, worker|
|
|
||||||
str = w.to_s
|
|
||||||
str =~ /iso_worker/ && str !~ /observer/
|
|
||||||
}
|
|
||||||
end
|
|
||||||
|
|
||||||
protected
|
|
||||||
|
|
||||||
def count_of_tasks(regexp)
|
|
||||||
Redis.current.smembers('resque:queues').
|
|
||||||
select{ |q| q =~ /#{regexp}/ }.
|
|
||||||
map{ |q| Redis.current.llen("resque:queue:#{q}") }.sum
|
|
||||||
end
|
|
||||||
|
|
||||||
def get_status(*queues)
|
|
||||||
status = {}
|
|
||||||
#queues.each do |worker|
|
|
||||||
# workers = Resque.workers.select{ |w| yield w, worker }
|
|
||||||
# status[worker] = status_of_worker workers, worker
|
|
||||||
#end
|
|
||||||
status
|
|
||||||
end
|
|
||||||
|
|
||||||
def status_of_worker(workers, worker)
|
|
||||||
key = "resque:queue:#{worker}_worker"
|
|
||||||
default_tasks, tasks = Redis.current.llen("#{key}_default"), Redis.current.llen(key)
|
|
||||||
{
|
|
||||||
workers: workers.count,
|
|
||||||
build_tasks: workers.select{ |w| w.working? }.count,
|
|
||||||
default_tasks: default_tasks,
|
|
||||||
low_tasks: tasks,
|
|
||||||
tasks: (default_tasks + tasks)
|
|
||||||
}
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,32 +1,20 @@
|
||||||
ul.nav.navbar-nav.navbar-left
|
.well.well-sm
|
||||||
li.bg-success
|
= t('layout.build_lists.build_server_status.rpm_workers')
|
||||||
a.no-pointer href=''
|
| :
|
||||||
i.fa.fa-info-circle.fa-lg.text-primary
|
=> t('layout.build_lists.build_server_status.abf')
|
||||||
=< t 'layout.build_lists.build_server_status.rpm_workers'
|
span.badge
|
||||||
' :
|
| {{::server_status.rpm.workers}}
|
||||||
=> t 'layout.build_lists.build_server_status.abf'
|
|
||||||
span.badge.bg-primary[] {{server_status.rpm.workers}}
|
|
||||||
=<> t 'layout.build_lists.build_server_status.custom'
|
=<> t 'layout.build_lists.build_server_status.custom'
|
||||||
span.badge.bg-primary[] {{server_status.rpm.other_workers}}
|
span.badge
|
||||||
|
| {{::server_status.rpm.other_workers}}
|
||||||
li.bg-info
|
=< t('layout.build_lists.build_server_status.tasks').mb_chars.capitalize
|
||||||
a.no-pointer href=''
|
| :
|
||||||
= t('layout.build_lists.build_server_status.tasks').mb_chars.capitalize
|
=<> t('layout.build_lists.build_server_status.custom')
|
||||||
' :
|
span.badge
|
||||||
=> t 'layout.build_lists.build_server_status.custom'
|
| {{::server_status.rpm.pending}}
|
||||||
span.badge.bg-primary[] {{server_status.rpm.default_tasks}}
|
|
||||||
=<> t 'layout.build_lists.build_server_status.mass_build_tasks'
|
=<> t 'layout.build_lists.build_server_status.mass_build_tasks'
|
||||||
span.badge.bg-primary[] {{server_status.rpm.low_tasks}}
|
span.badge
|
||||||
=<> t 'layout.build_lists.build_server_status.build_tasks'
|
| {{::server_status.rpm.mass_build_pending}}
|
||||||
span.badge.bg-primary[] {{server_status.rpm.build_tasks}}
|
=<> t('layout.build_lists.build_server_status.build_tasks')
|
||||||
|
span.badge
|
||||||
li.bg-warning
|
| {{::server_status.rpm.build_tasks}}
|
||||||
a.no-pointer href=''
|
|
||||||
= t 'layout.build_lists.build_server_status.publish_workers'
|
|
||||||
' :
|
|
||||||
=> t 'layout.build_lists.build_server_status.amount'
|
|
||||||
span.badge.bg-primary[] {{server_status.publish.workers}}
|
|
||||||
=<> t 'layout.build_lists.build_server_status.tasks'
|
|
||||||
span.badge.bg-primary[] {{server_status.publish.tasks}}
|
|
||||||
=<> t 'layout.build_lists.build_server_status.build_tasks'
|
|
||||||
span.badge.bg-primary[] {{server_status.publish.build_tasks}}
|
|
|
@ -1,5 +1,6 @@
|
||||||
.row.top-space
|
.row.top-space
|
||||||
.col-md-12 ng-controller="BuildListsController" ng-init=('getBuildLists("'+params[:name_with_owner].to_s+'")')
|
.col-md-12 ng-controller="BuildListsController" ng-init=('getBuildLists("'+params[:name_with_owner].to_s+'")')
|
||||||
|
== render 'projects/build_lists/server_status'
|
||||||
== render 'projects/build_lists/filter'
|
== render 'projects/build_lists/filter'
|
||||||
rd-widget
|
rd-widget
|
||||||
rd-widget-header title="Build Lists {{::widgetTitle}}" icon="fa-gears"
|
rd-widget-header title="Build Lists {{::widgetTitle}}" icon="fa-gears"
|
||||||
|
|
Loading…
Reference in New Issue