From c2ed47a7368a81b8de2e0fa24d547abb1b3c3f0e Mon Sep 17 00:00:00 2001 From: guange Date: Tue, 10 Dec 2019 13:50:14 +0800 Subject: [PATCH] add test jupyter call --- app/controllers/main_controller.rb | 19 +++++++++++++++++++ config/routes.rb | 3 +++ 2 files changed, 22 insertions(+) diff --git a/app/controllers/main_controller.rb b/app/controllers/main_controller.rb index 0e2628c3e..5e9486277 100644 --- a/app/controllers/main_controller.rb +++ b/app/controllers/main_controller.rb @@ -2,4 +2,23 @@ class MainController < ApplicationController def index render file: 'public/react/build/index.html', :layout => false end + + + + def test_juypter + #打开tpm - juypter接口 + shixun = Shixun.find() + shixun_tomcat = edu_setting('cloud_bridge') + uri = "#{shixun_tomcat}/bridge/jupyter/get" + params = {tpiID: "tpm_#{shixun.id}", :containers => "#{Base64.urlsafe_encode64(shixun_container_limit(shixun))}"} + + + logger.debug "test_juypter: uri->#{uri}, params->#{params}" + + res = uri_post uri, params + + logger.info "test_juypter: #{res}" + + res.to_json + end end \ No newline at end of file diff --git a/config/routes.rb b/config/routes.rb index ad4cd56d5..ec16d85fa 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -9,6 +9,9 @@ Rails.application.routes.draw do get 'auth/qq/callback', to: 'oauth/qq#create' get 'auth/failure', to: 'oauth/base#auth_failure' + + get 'test_juypter', to: 'main#test_juypter' + resources :edu_settings scope '/api' do get 'home/index'