|
|
|
@ -1,10 +1,38 @@
|
|
|
|
|
require 'net/http'
|
|
|
|
|
|
|
|
|
|
class JupytersController < ApplicationController
|
|
|
|
|
|
|
|
|
|
include JupyterService
|
|
|
|
|
|
|
|
|
|
before_action :shixun, only: [:open, :open1, :test, :save]
|
|
|
|
|
|
|
|
|
|
def save_with_tpi
|
|
|
|
|
game = Game.find_by(identifier: params[:identifier])
|
|
|
|
|
jupyter_save_with_game(game, params[:jupyter_port])
|
|
|
|
|
render json: {status: 0}
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def save_with_tpm
|
|
|
|
|
shixun = Shixun.find_by(identifier: params[:identifier])
|
|
|
|
|
jupyter_save_with_shixun(shixun, params[:jupyter_port])
|
|
|
|
|
render json: {status: 0}
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def get_info_with_tpi
|
|
|
|
|
game = Game.find_by(identifier: params[:identifier])
|
|
|
|
|
url = jupyter_url_with_game(game)
|
|
|
|
|
port = jupyter_port_with_game(game)
|
|
|
|
|
render json: {status: 0, url: url, port: port}
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def get_info_with_tpm
|
|
|
|
|
shixun = Shixun.find_by(identifier: params[:identifier])
|
|
|
|
|
url = jupyter_url_with_shixun(shixun)
|
|
|
|
|
port = jupyter_port_with_shixun(shixun)
|
|
|
|
|
render json: {status: 0, url: url, port: port}
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
before_action :shixun
|
|
|
|
|
private
|
|
|
|
|
|
|
|
|
|
def open
|
|
|
|
|
#打开tpm - juypter接口
|
|
|
|
|