chromesetting
daiao 5 years ago
parent 99d35c791c
commit 490e08e6a5

@ -20,15 +20,8 @@ module JupyterService
logger.info "test_juypter: #{res}" logger.info "test_juypter: #{res}"
@shixun_jupyter_port = res['port'] @shixun_jupyter_port = res['port']
jupyter_service = edu_setting('jupyter_service')
"https://#{jupyter_service(res['port'])}}/notebooks/data/workspace/myshixun_#{tpiID}/01.ipynb"
url =
if false
"https://#{jupyter_service}:#{res['port']}/notebooks/data/workspace/myshixun_#{tpiID}/01.ipynb"
else
"https://#{res['port']}.#{jupyter_service}/notebooks/data/workspace/myshixun_#{tpiID}/01.ipynb"
end
return url
end end
end end
@ -69,14 +62,7 @@ module JupyterService
repo_save_path = myshixun.repo_save_path repo_save_path = myshixun.repo_save_path
jupyter_service = edu_setting('jupyter_service') "https://#{jupyter_service(res['port'])}}/notebooks/data/workspace/myshixun_#{tpiID}/#{repo_save_path}/01.ipynb"
if false
"https://#{jupyter_service}:#{res['port']}/notebooks/data/workspace/myshixun_#{tpiID}/#{repo_save_path}/01.ipynb"
else
"https://#{res['port']}.#{jupyter_service}/notebooks/data/workspace/myshixun_#{tpiID}/#{repo_save_path}/01.ipynb"
end
end end
end end
@ -99,14 +85,8 @@ module JupyterService
tpiID = "tpm#{shixun.id}" tpiID = "tpm#{shixun.id}"
jupyter_service = edu_setting('jupyter_service') src_url = "#{jupyter_service(jupyter_port)}/nbconvert/notebook/data/workspace/myshixun_#{tpiID}/01.ipynb?download=true"
src_url =
if false
"https://#{jupyter_service}:#{jupyter_port}/nbconvert/notebook/data/workspace/myshixun_#{tpiID}/01.ipynb?download=true"
else
"https://#{jupyter_port}.#{jupyter_service}/nbconvert/notebook/data/workspace/myshixun_#{tpiID}/01.ipynb?download=true"
end
#https://47526.jupyter.educoder.net/nbconvert/notebook/data/workspace/myshixun_570461/f2ef5p798r20191210163135/01.ipynb?download=true
response = Faraday.get(src_url) response = Faraday.get(src_url)
if response.status.to_i != 200 if response.status.to_i != 200
@ -134,14 +114,7 @@ module JupyterService
repo_save_path = myshixun.repo_save_path repo_save_path = myshixun.repo_save_path
jupyter_service = edu_setting('jupyter_service') jupyter_service = edu_setting('jupyter_service')
"https://#{jupyter_service(jupyter_port)}/nbconvert/notebook/data/workspace/myshixun_#{tpiID}/#{repo_save_path}/01.ipynb?download=true"
src_url =
if false
"https://#{jupyter_service}:#{jupyter_port}/nbconvert/notebook/data/workspace/myshixun_#{tpiID}/#{repo_save_path}/01.ipynb?download=true"
else
"https://#{jupyter_port}.#{jupyter_service}/nbconvert/notebook/data/workspace/myshixun_#{tpiID}/#{repo_save_path}/01.ipynb?download=true"
end
response = Faraday.get(src_url) response = Faraday.get(src_url)
if response.status.to_i != 200 if response.status.to_i != 200
@ -215,5 +188,9 @@ module JupyterService
end end
end end
def jupyter_service jupyter_port
edu_setting('jupyter_service').gsub("PORT", jupyter_port)
end
end end

Loading…
Cancel
Save