|
|
|
@ -26,7 +26,14 @@ class CreateShixunService < ApplicationService
|
|
|
|
|
# 创建镜像
|
|
|
|
|
ShixunMirrorRepository.create!(:shixun_id => shixun.id, :mirror_repository_id => main_mirror.id)
|
|
|
|
|
# 创建主服务配置
|
|
|
|
|
ShixunServiceConfig.create!(:shixun_id => shixun.id, :mirror_repository_id => main_mirror.id)
|
|
|
|
|
config_params =
|
|
|
|
|
if shixun.is_jupyter?
|
|
|
|
|
{shixun_id: shixun.id, mirror_repository_id: main_mirror.id, cpu_limit: 2,
|
|
|
|
|
memory_limit: 1024, lower_cpu_limit: 0.2, request_limit: 100}
|
|
|
|
|
else
|
|
|
|
|
{shixun_id: shixun.id, mirror_repository_id: main_mirror.id}
|
|
|
|
|
end
|
|
|
|
|
ShixunServiceConfig.create!(config_params)
|
|
|
|
|
# 创建子镜像相关数据(实训镜像关联表,子镜像服务配置)
|
|
|
|
|
sub_mirrors.each do |sub|
|
|
|
|
|
ShixunMirrorRepository.create!(:shixun_id => shixun.id, :mirror_repository_id => sub.id)
|
|
|
|
|