show file size, and in_queue status for ProductBuildList

This commit is contained in:
Vokhmin Alexey V 2012-11-19 19:11:07 +04:00
parent ec68d070f7
commit ebbf47f818
5 changed files with 29 additions and 10 deletions

View File

@ -3,18 +3,24 @@ class ProductBuildList < ActiveRecord::Base
include Modules::Models::CommitAndVersion
delegate :url_helpers, to: 'Rails.application.routes'
BUILD_STARTED = 2
BUILD_COMPLETED = 0
BUILD_FAILED = 1
BUILD_FAILED = 1
BUILD_IN_QUEUE = 2
BUILD_STARTED = 3
BUILD_CANCELED = 4
STATUSES = [ BUILD_STARTED,
BUILD_COMPLETED,
BUILD_FAILED
BUILD_FAILED,
BUILD_IN_QUEUE,
BUILD_CANCELED
]
HUMAN_STATUSES = { BUILD_STARTED => :build_started,
BUILD_COMPLETED => :build_completed,
BUILD_FAILED => :build_failed
BUILD_FAILED => :build_failed,
BUILD_IN_QUEUE => :in_queue,
BUILD_CANCELED => :build_canceled
}
belongs_to :product
@ -28,7 +34,7 @@ class ProductBuildList < ActiveRecord::Base
:main_script,
:time_living,
:arch_id, :presence => true
validates :status, :inclusion => { :in => [BUILD_STARTED, BUILD_COMPLETED, BUILD_FAILED] }
validates :status, :inclusion => { :in => STATUSES }
attr_accessor :base_url
attr_accessible :status,
@ -84,6 +90,7 @@ class ProductBuildList < ActiveRecord::Base
end
def stop
update_attributes({:status => BUILD_CANCELED})
Resque.redis.setex(
"abfworker::iso-worker-#{id}::live-inspector",
120, # Data will be removed from Redis after 120 sec.
@ -105,8 +112,8 @@ class ProductBuildList < ActiveRecord::Base
options = {
:id => id,
# TODO: remove comment
# :srcpath => 'http://dl.dropbox.com/u/945501/avokhmin-test-iso-script-5d9b463d4e9c06ea8e7c89e1b7ff5cb37e99e27f.tar.gz',
:srcpath => srcpath,
:srcpath => 'http://dl.dropbox.com/u/945501/avokhmin-test-iso-script-5d9b463d4e9c06ea8e7c89e1b7ff5cb37e99e27f.tar.gz',
# :srcpath => srcpath,
:params => params,
:time_living => time_living,
:main_script => main_script,

View File

@ -39,12 +39,14 @@
%tr
%th= t("activerecord.attributes.product_build_list/results.file_name")
%th= t("activerecord.attributes.product_build_list/results.sha1")
%th= t("activerecord.attributes.product_build_list/results.size")
%tbody
- pbl.results.each do |item|
%tr
- sha1 = item['sha1']
%td= link_to item['file_name'], "http://file-store.rosalinux.ru/api/v1/file_stores/#{sha1}"
%td= sha1
%td= item['size']
.both

View File

@ -17,10 +17,14 @@ en:
statuses:
'0': 'build'
'1': 'build error'
'2': 'build in progress'
'2': 'in queue'
'3': 'build in progress'
'4': 'build canceled'
build_failed: Build failed
build_started: Build in progress
build_completed: Built
build_canceled: Build canceled
in_queue: In queue
ownership:
header: Build list ownership
@ -46,6 +50,7 @@ en:
product_build_list/results:
file_name: File name
sha1: SHA1
size: Size (MB)
flash:
product_build_list:

View File

@ -17,10 +17,14 @@ ru:
statuses:
'0': 'собран'
'1': 'ошибка сборки'
'2': 'собирается'
'2': 'в очереди'
'3': 'собирается'
'4': 'отменен'
build_failed: Ошибка сборки
build_started: Собирается
build_completed: Собран
build_canceled: Отменен
in_queue: В очереди
ownership:
header: Принадлежность заданий
@ -46,6 +50,7 @@ ru:
product_build_list/results:
file_name: Имя файла
sha1: SHA1
size: Размер (МБ)
flash:
product_build_list:

View File

@ -5,7 +5,7 @@ module AbfWorker
def self.perform(options)
status = options['status'].to_i
pbl = ProductBuildList.find options['id']
pbl.status = status
pbl.status = status if pbl.status != ProductBuildList::BUILD_CANCELED
pbl.results = options['results'] if status != ProductBuildList::BUILD_STARTED
pbl.save!
end