|
|
@ -1,19 +1,19 @@
|
|
|
|
class AddLimitForShixuns < ActiveRecord::Migration
|
|
|
|
class AddLimitForShixuns < ActiveRecord::Migration
|
|
|
|
def up
|
|
|
|
def up
|
|
|
|
if !Challenge.first.has_attribute?(:exec_time)
|
|
|
|
# if !Challenge.first.has_attribute?(:exec_time)
|
|
|
|
add_column :challenges, :exec_time, :integer, :default => 120
|
|
|
|
# add_column :challenges, :exec_time, :integer, :default => 120
|
|
|
|
end
|
|
|
|
# end
|
|
|
|
Shixun.find_each do |shixun|
|
|
|
|
# Shixun.find_each do |shixun|
|
|
|
|
shixun.challenges.update_all(:exec_time => shixun.exec_time)
|
|
|
|
# shixun.challenges.update_all(:exec_time => shixun.exec_time)
|
|
|
|
shixun.mirror_repositories.each do |mirror|
|
|
|
|
# shixun.mirror_repositories.each do |mirror|
|
|
|
|
ShixunServiceConfig.create!(:shixun_id => shixun.id,
|
|
|
|
# ShixunServiceConfig.create!(:shixun_id => shixun.id,
|
|
|
|
:cpu_limit => mirror.cpu_limit,
|
|
|
|
# :cpu_limit => mirror.cpu_limit,
|
|
|
|
:memory_limit => mirror.memory_limit,
|
|
|
|
# :memory_limit => mirror.memory_limit,
|
|
|
|
:request_limit => mirror.memory_limit / 3,
|
|
|
|
# :request_limit => mirror.memory_limit / 3,
|
|
|
|
:mirror_repository_id => mirror.id)
|
|
|
|
# :mirror_repository_id => mirror.id)
|
|
|
|
end
|
|
|
|
# end
|
|
|
|
end
|
|
|
|
# end
|
|
|
|
|
|
|
|
#
|
|
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|