Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What's the use of Jupyter Notebook?

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly introduces the use of Jupyter Notebook, the article is very detailed, has a certain reference value, interested friends must read it!

What is JupyterHub?

Jupyter Notebook is a powerful tool for scientific data analysis, and JupyterHub can host the Jupyter runtime environment for multiple users in a server environment. JupyterHub is a multi-user data exploration tool and is usually a key tool for the research and development of data science and machine learning. It provides engineers, scientists, researchers, and students with the computing power of a cloud or data center, while still as easy to use as a local development environment. In essence, JupyterHub gives users access to computing environments and resources without burdening them with installation and maintenance tasks. Users can use shared resources in the workspace, and the system administrator will manage them effectively.

Using Kubernetes in AI/ML workload

Kubernetes is very good at letting us take advantage of large distributed computing environments. Because of its declarative design and discovery-based server addressing, it is easy to apply computing resources to workloads. Usually in AI/ML workloads, engineers or researchers need to allocate more resources. Kubernetes makes it more feasible to migrate workloads between physical infrastructures. In this article, we will show you how to install JupyterHub using Rancher.

Install JupyterHub using Rancher

First, suppose we have a modern Kubernetes deployment in a Rancher environment. At the time of this release, the stable version of Kubernetes is 1.16. One of the upfront preparations for JupyterHub is persistent storage, so you will need to think about how to provide it in this cluster. For demonstration purposes, we can use the experimental NFS provider included with Rancher Catalog to provide persistent storage. Click App Catalog and select [start]. Then search for the NFS provider. Leave the default settings, and then click start at the bottom of the screen. If you already have a persistent storage solution, you can also use it directly.

Navigate to Rancher App Catalog

Search for NFS provider

Start the NFS provider

Now that we have a storage provider and define a default storage class, we can continue to deploy the application components. We will use Helm3 to do this. Check the helm official documentation (https://helm.sh/docs/intro/install/) and install the helm3 client on your computer. Alternatively, you can use Rancher Catalog to deploy helm chart without any other tools. You need to make sure that repo is added to the Rancher catalog.

Before we can use helm, we need to create a namespace for the application. In Rancher UI, enter the cluster and select [Project / Namespace] in the top menu bar. You can create a new namespace for JupyterHub. For example, we call the namespace "jhub". Please pay attention to this name because we will use it later.

Create a namespace

Next, we can add a Helm repo to the JupyterHub Chart we are going to use. If you are using Rancher catalog, you need to do this on UI instead of Helm CLI:

Helm repo add jupyterhub https://jupyterhub.github.io/helm-chart/helm repo update

Then, let's create a config file that contains the settings we want to use with this chart. Let's name the file config.yaml:

Proxy: secretToken: "" ingress: enabled: true hosts:-

Let's replace a few items so that they are unique. Replace secretToken with the following output:

Openssl rand-hex 32

And replace it with the resolvable DNS name you intend to use to access JyupiterHub UI.

Once you have the configuration file, you can install chart. We will reference the configuration file, so make sure it is in your current working directory:

RELEASE=jhubNAMESPACE=jhubhelm upgrade-install $RELEASE jupyterhub/jupyterhub-namespace $NAMESPACE-version=0.8.2-values config.yaml

Helm should now deploy the required components. This will take some time, but eventually you should be able to access UI through the hostname you set earlier. You can also check the status by going to the workloads tab in Rancher UI. When we try to set the hostname in the browser, it displays the following login interface:

Host name login interface

At the time of this writing, one issue was a change in Kubernetes 1.16 that caused Jyupiter Hub's code to break while trying to interact with Kuberentes API. If we want to fix it immediately, we can run the following patch command:

Kubectl patch deploy-n $NAMESPACE hub-- type json-- patch'[{"op": "replace", "path": "/ spec/template/spec/containers/0/command", "value": ["bash", "- c" "\ nmkdir-p ~ / hotfix\ ncp-r / usr/local/lib/python3.6/dist-packages/kubespawner ~ / hotfix\ nls-R ~ / hotfix\ npatch ~ / hotfix/kubespawner/spawner.py key=lambda x: x.last_timestamp and x.last_timestamp.timestamp () or 0,\ nEOT\ n\ nPYTHONPATH=$HOME/hotfix jupyterhub-- config / srv/jupyterhub_config.py-- upgrade-db\ n]}]'

You have now deployed a working JupyterHub environment on Rancher. By default, JupyterHub uses PAM authentication. Therefore, you can log in using any valid Linux user on the system. After logging in, we should be able to create a new notebook:

Jupyter login interface

Create a new notebook

In addition, you can view other authentication options that you may want to configure. For example, you can use Github authentication to allow users to log in and create a notebook based on their Github ID. After you have selected an authentication tool, you need to follow the instructions to update the config.yml file we created earlier, and then rerun the helm upgrade command.

The above is all the content of this article "what's the use of Jupyter Notebook?" Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report