|
|
|
@ -20,15 +20,8 @@ module JupyterService
|
|
|
|
|
logger.info "test_juypter: #{res}"
|
|
|
|
|
|
|
|
|
|
@shixun_jupyter_port = res['port']
|
|
|
|
|
jupyter_service = edu_setting('jupyter_service')
|
|
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
|
|
|
"#{jupyter_service(res['port'])}/notebooks/data/workspace/myshixun_#{tpiID}/01.ipynb"
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
@ -55,7 +48,7 @@ module JupyterService
|
|
|
|
|
|
|
|
|
|
tpiID = myshixun.id
|
|
|
|
|
mount = myshixun.shixun.data_sets.present?
|
|
|
|
|
params = {tpiID: tpiID, identifier: shixun.identifier, needMount: mount,
|
|
|
|
|
params = {tpiID: tpiID, identifier: shixun.identifier, myshixunIdentifier: myshixun.identifier, needMount: mount,
|
|
|
|
|
:containers => "#{Base64.urlsafe_encode64(shixun_container_limit(shixun))}"}
|
|
|
|
|
res = uri_post uri, params
|
|
|
|
|
|
|
|
|
@ -69,14 +62,7 @@ module JupyterService
|
|
|
|
|
|
|
|
|
|
repo_save_path = myshixun.repo_save_path
|
|
|
|
|
|
|
|
|
|
jupyter_service = edu_setting('jupyter_service')
|
|
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
|
|
|
"#{jupyter_service(res['port'])}/notebooks/data/workspace/myshixun_#{tpiID}/#{repo_save_path}/01.ipynb"
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
@ -99,14 +85,8 @@ module JupyterService
|
|
|
|
|
|
|
|
|
|
tpiID = "tpm#{shixun.id}"
|
|
|
|
|
|
|
|
|
|
jupyter_service = edu_setting('jupyter_service')
|
|
|
|
|
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
|
|
|
|
|
src_url = "#{jupyter_service(jupyter_port)}/nbconvert/notebook/data/workspace/myshixun_#{tpiID}/01.ipynb?download=true"
|
|
|
|
|
|
|
|
|
|
response = Faraday.get(src_url)
|
|
|
|
|
|
|
|
|
|
if response.status.to_i != 200
|
|
|
|
@ -133,15 +113,7 @@ module JupyterService
|
|
|
|
|
tpiID = myshixun.id
|
|
|
|
|
|
|
|
|
|
repo_save_path = myshixun.repo_save_path
|
|
|
|
|
jupyter_service = edu_setting('jupyter_service')
|
|
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
|
|
|
src_url = "#{jupyter_service(jupyter_port)}/nbconvert/notebook/data/workspace/myshixun_#{tpiID}/#{repo_save_path}/01.ipynb?download=true"
|
|
|
|
|
response = Faraday.get(src_url)
|
|
|
|
|
|
|
|
|
|
if response.status.to_i != 200
|
|
|
|
@ -215,5 +187,9 @@ module JupyterService
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def jupyter_service jupyter_port
|
|
|
|
|
edu_setting('jupyter_service').gsub("PORT", jupyter_port)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|