Skip to content

Visual Studio Code

You can use Visual Studio Code if you need a quick development environment with interactive access to resources.

To create a VS Code environment:

  1. Go to https://ml.cern.ch/_/jupyter/
  2. Select New Notebook
  3. Select Visual Studio Code
  4. Select a name that starts with a letter (not a number)
  5. Select an image under Custom Notebook

    Tip

    The fastest way to start development is to select one of pre-built images to run a Jupyter notebook. Pre-built images contain most functionalities to provide machine learning training and integrate with existing CERN services.
    Pre-built images contain:

    • Python 3.
    • TensorFlow, Pytorch or SciPy.
    • Common Python libraries: matplotlib, boto3, sklearn
    • kfp library for intergration with Kubeflow pipelines
  6. Select the number of CPUs and amount of Memory

  7. Select the number of GPUs

    Available GPUs

    Personal profiles have a quota limit of 1 GPU.

  8. Configuring Additional Notebook Storage

    • By default, EOS is automatically authenticated and mounted as your home directory in the notebook

    Storage

    Volume storage should not be used for large datasets. Use EOS for most data storage needs.

    • Under Workspace Volume, click on Add new volume
    • Configure the new volume:
      • Size: Specify the desired size (e.g., 3Gi)
      • Storage Class: Select manila-meyrin-cephfs
      • Access Mode: Select ReadWriteMany (recommended for most use cases)
    • This volume is mounted at the default path of /home/jovyan
  9. Wait until notebook server starts, then click Connect

How to reuse a custom image?

FROM base AS code-server

# Install kubectl so you can interact with Kubernetes
RUN apt update && apt install -y curl
RUN curl -LO https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl
RUN chmod +x ./kubectl
RUN mv ./kubectl /usr/local/bin

# Install VS Code server
ARG CODE_SERVER_VERSION=4.96.4
RUN curl -fOL https://github.com/coder/code-server/releases/download/v${CODE_SERVER_VERSION}/code-server_${CODE_SERVER_VERSION}_amd64.deb
RUN dpkg -i code-server_${CODE_SERVER_VERSION}_amd64.deb

# Install extensions 
RUN mkdir /code-server-extensions
RUN chmod -R 777 /code-server-extensions
ENV XDG_DATA_HOME=/code-server-extensions
RUN code-server --install-extension ms-python.python
RUN code-server --install-extension ms-toolsai.jupyter
RUN pip install ipykernel

# User needs to be 1000 so that EOS token authentication works
USER 1000

CMD ["code-server", "--auth=none", "--bind-addr=0.0.0.0:8888"]
  1. Build Docker image:

    docker build . -f Dockerfile -t registry.cern.ch/[PROJECT_NAME]/[REPOSITORY_NAME]
    

  2. Login to CERN docker registry (See Kubernetes docs for more help):

    docker login registry.cern.ch
    

  3. Push built custom image to a container registry:

    docker push registry.cern.ch/[PROJECT_NAME]/[REPOSITORY_NAME]
    

  4. Create the new VS Code Server by following the steps here and use registry.cern.ch/[PROJECT_NAME]/[REPOSITORY_NAME]:[IMAGE_TAG] as the image.