2016-03-20 09:24:23 +00:00
|
|
|
class AbfWorkerStatusPresenter
|
2014-06-20 19:02:32 +01:00
|
|
|
|
|
|
|
def initialize
|
|
|
|
end
|
|
|
|
|
|
|
|
def projects_status
|
2016-06-15 01:17:42 +01:00
|
|
|
Rails.cache.fetch([AbfWorkerStatusPresenter, :projects_status], expires_in: 30.seconds) do
|
|
|
|
result = {rpm: {}}
|
2014-06-20 19:02:32 +01:00
|
|
|
nodes = RpmBuildNode.total_statistics
|
2016-06-15 01:17:42 +01:00
|
|
|
result[:rpm][:workers] = nodes[:systems]
|
|
|
|
result[:rpm][:build_tasks] = nodes[:busy]
|
2014-06-20 19:02:32 +01:00
|
|
|
result[:rpm][:other_workers] = nodes[:others]
|
|
|
|
|
2016-06-15 01:17:42 +01:00
|
|
|
normal_pending = BuildList.for_status(BuildList::BUILD_PENDING).where(mass_build_id: nil).count
|
|
|
|
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
|
2014-06-20 19:02:32 +01:00
|
|
|
|
|
|
|
result
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|