|
|
|
@ -0,0 +1,43 @@
|
|
|
|
|
class JupytersController < ApplicationController
|
|
|
|
|
|
|
|
|
|
def open
|
|
|
|
|
#打开tpm - juypter接口
|
|
|
|
|
shixun = Shixun.find(3575)
|
|
|
|
|
shixun_tomcat = edu_setting('cloud_bridge')
|
|
|
|
|
uri = "#{shixun_tomcat}/bridge/jupyter/get"
|
|
|
|
|
tpiID = "tpm#{shixun.id}"
|
|
|
|
|
params = {tpiID: tpiID, :containers => "#{Base64.urlsafe_encode64(shixun_container_limit(shixun))}"}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
logger.info "test_juypter: uri->#{uri}, params->#{params}"
|
|
|
|
|
|
|
|
|
|
res = uri_post uri, params
|
|
|
|
|
|
|
|
|
|
logger.info "test_juypter: #{res}"
|
|
|
|
|
|
|
|
|
|
render plain: "https://#{res['port']}.jupyter.educoder.net/data/workspace/myshixun_#{tpiID}/01.ipynb"
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def open1
|
|
|
|
|
## 打开tpi
|
|
|
|
|
game = Game.find(0)
|
|
|
|
|
shixun = game.myshixun.shixun
|
|
|
|
|
shixun_tomcat = edu_setting('cloud_bridge')
|
|
|
|
|
uri = "#{shixun_tomcat}/bridge/jupyter/get"
|
|
|
|
|
params = {tpiID: game.myshixun.id, :containers => "#{Base64.urlsafe_encode64(shixun_container_limit(shixun))}"}
|
|
|
|
|
res = uri_post uri, params
|
|
|
|
|
|
|
|
|
|
logger.info "test_juypter: #{res}"
|
|
|
|
|
|
|
|
|
|
if res && res['code'].to_i != 0
|
|
|
|
|
raise("实训云平台繁忙(繁忙等级:99)")
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def test
|
|
|
|
|
render plain: 'test'
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
end
|