mirror of
https://github.com/clearml/clearml
synced 2025-01-31 09:07:00 +00:00
When launching jupyter notebook instance, pass base docker image to the running jupyter
This commit is contained in:
parent
e9f950f939
commit
29727b80b7
@ -8,13 +8,13 @@ from tempfile import mkstemp
|
||||
import psutil
|
||||
|
||||
# make sure we have jupyter in the auto requirements
|
||||
import jupyter # noqa
|
||||
from trains import Task
|
||||
|
||||
# set default docker image, with network configuration
|
||||
os.environ["TRAINS_DOCKER_IMAGE"] = "nvidia/cuda --network host"
|
||||
|
||||
# initialize TRAINS
|
||||
task = Task.init(project_name="examples", task_name="Remote Jupyter NoteBook", task_type=Task.TaskTypes.service)
|
||||
task = Task.init(
|
||||
project_name="DevOps", task_name="Allocate Jupyter Notebook Instance", task_type=Task.TaskTypes.service)
|
||||
|
||||
# get rid of all the runtime TRAINS
|
||||
preserve = (
|
||||
@ -25,6 +25,7 @@ preserve = (
|
||||
"TRAINS_API_ACCESS_KEY",
|
||||
"TRAINS_API_SECRET_KEY",
|
||||
"TRAINS_API_HOST_VERIFY_CERT",
|
||||
"TRAINS_DOCKER_IMAGE",
|
||||
)
|
||||
|
||||
# setup os environment
|
||||
@ -38,9 +39,15 @@ param = {
|
||||
"jupyter_server_base_directory": "~/",
|
||||
"ssh_server": True,
|
||||
"ssh_password": "training",
|
||||
"default_docker_for_jupyter": "nvidia/cuda",
|
||||
}
|
||||
task.connect(param)
|
||||
|
||||
# set default docker image, with network configuration
|
||||
os.environ["TRAINS_DOCKER_IMAGE"] = param['default_docker_for_jupyter']
|
||||
task.set_base_docker("{} --network host".format(param['default_docker_for_jupyter']))
|
||||
|
||||
|
||||
# noinspection PyBroadException
|
||||
try:
|
||||
hostname = socket.gethostname()
|
||||
|
3
examples/services/jupyter-service/requirements.txt
Normal file
3
examples/services/jupyter-service/requirements.txt
Normal file
@ -0,0 +1,3 @@
|
||||
jupyter
|
||||
psutil
|
||||
trains
|
Loading…
Reference in New Issue
Block a user