add get pod timeinfo

dev_static
guange 5 years ago
parent bd2e25ec00
commit f8735c56fd

@ -80,4 +80,17 @@ class JupytersController < ApplicationController
render json: {status: 0}
end
def timeinfo_with_tpm
shixun = Shixun.find_by(identifier: params[:identifier])
info = jupyter_timeinfo_tpm(shixun)
render json: {status: 0}.merge(info)
end
def timeinfo_with_tpi
myshixun = Myshixun.find_by(identifier: params[:identifier])
info = jupyter_timeinfo_tpi(shixun)
render json: {status: 0}.merge(info)
end
end

@ -213,4 +213,27 @@ module JupyterService
_jupyter_active(tpiID)
end
def _jupyter_timeinfo(tpiID)
shixun_tomcat = edu_setting('cloud_bridge')
uri = "#{shixun_tomcat}/bridge/jupyter/getTimeInfo"
params = {:tpiID => tpiID}
res = uri_post uri, params
if res && res['code'].to_i != 0
raise("实训云平台繁忙繁忙等级130")
end
res['data']
end
# 获取时间参数
def jupyter_timeinfo_tpm(shixun)
tpiID = "tpm#{shixun.id}"
_jupyter_timeinfo(tpiID)
end
# 获取时间参数
def jupyter_timeinfo_tpi(myshixun)
tpiID = myshixun.id
_jupyter_timeinfo(tpiID)
end
end

@ -35,6 +35,8 @@ Rails.application.routes.draw do
get :reset_with_tpm
get :active_with_tpm
get :active_with_tpi
get :timeinfo_with_tpm
get :timeinfo_with_tpi
post :import_with_tpm
end

Loading…
Cancel
Save