tpi jupyter

chromesetting
guange 5 years ago
parent 8171634918
commit 8782554b32

@ -10,6 +10,16 @@ class GamesController < ApplicationController
include GamesHelper
include ApplicationHelper
include JupyterService
helper_method :jupyter_url_with_game, :jupyter_port_with_game
def update_jupyter
jupyter_save_with_game(@game, params[:jupyter_port])
end
def show
uid_logger("--games show start")
# 防止评测中途ajaxE被取消;3改成0是为了处理首次进入下一关的问题

@ -14,7 +14,7 @@ module JupyterService
if res && res['code'].to_i != 0
raise("实训云平台繁忙繁忙等级99")
end
logger.info "test_juypter: #{res}"
@shixun_jupyter_port = res['port']
@ -35,7 +35,8 @@ module JupyterService
@shixun_jupyter_port
end
def jupyter_url_with_game(game)
def _open_game_jupyter(game)
## 打开tpi
shixun = game.myshixun.shixun
@ -53,6 +54,8 @@ module JupyterService
raise("实训云平台繁忙繁忙等级99")
end
@game_jupyter_port = res['port']
repo_save_path = game.myshixun.repo_save_path
"https://#{res['port']}.jupyter.educoder.net/notebooks/data/workspace/myshixun_#{tpiID}/#{repo_save_path}/01.ipynb"
@ -60,6 +63,17 @@ module JupyterService
end
def jupyter_url_with_game(game)
_open_game_jupyter(game)
end
def jupyter_port_with_game(game)
if @game_jupyter_port.to_i <=0
_open_game_jupyter(shixun)
end
@game_jupyter_port
end
def jupyter_save_with_shixun(shixun,jupyter_port)
author_name = current_user.real_name
author_email = current_user.git_mail

@ -20,3 +20,6 @@ else
json.choose_test_cases @choose_test_cases
json.chooses @chooses
end
json.jupyter_url jupyter_url_with_game(@game)
json.jupyter_port jupyter_port_with_game(@game)

@ -219,6 +219,8 @@ Rails.application.routes.draw do
get :unlock_choose_answer
get :get_choose_answer
post :update_jupyter
end
collection do
get :challenges

Loading…
Cancel
Save