Creating a Notebook Instance with a Git Repository
ModelArts Notebook allows you to download the public and private repositories of GitHub and perform graphical operations based on the Git plug-in of JupyterLab.
Prerequisites
- Currently, the Git repository supports only notebook instances of the EVS type. When creating a notebook instance, you can enable or disable the Git repository only when EVS is selected for Storage. The Git repository is disabled by default.
- Figure 1 shows the configuration details after the Git repository is enabled. Git repositories are classified into private repositories and public repositories.
- The configured code library is downloaded to the corresponding path (/home/ma-user/work) of the notebook instance. You can use the Git plug-in of JupyterLab to start Git use. For details, see Using the Git Plug-in.
- When a notebook instance is stopped and restarted, if a directory with the same project name exists in the /home/ma-user/work directory, the notebook instance will not be downloaded again. In addition, the git_exception.log file is generated in the work directory, indicating that a file with the same name already exists. If the directory does not exist, the notebook instance will be downloaded again after the system is restarted.
Downloading a GitHub Public Repository
After setting Repository Type to Public repository, enter the organization name on GitHub, for example, jupyter, and press Enter or click the search button on the right to view the code library and branch content. If the system responds slowly after you click the search button, wait for a moment.
If the organization has multiple code libraries or branches, you can select the name of the repository to be downloaded from the code library list and select the name of the branch to be downloaded from the branch list. After the configuration is complete, click Next to create a notebook instance.
Downloading a GitHub Private Repository
Currently, a GitHub private repository can be downloaded in OAuth authorization mode.
- Set Repository Type to Private repository and click Authorize with OAuth.
Figure 3 Authorize with OAuth
- Perform the operations as follows:
- If you have logged in to GitHub, the authorization page is displayed.
- If you have not logged in to GitHub, the login page is displayed. Enter the correct username or email address and password and click Sign in. After the login is successful, the authentication information is displayed. Click Authorize ModelArts-Lab to enable authorization.
Figure 4 Login page
When a message is displayed indicating that authorization is created, the GitHub account has been authorized. Manually close the authorization page and go to the Create Notebook page.
- Click OK.
If you click Cancel in the dialog box, the OAuth authorization fails and the code of the private repository cannot be downloaded.
Figure 5 Authentication completed or not
- After the authorization is completed, select the repository and branch under the GitHub account from the drop-down list. Set Username/Organization, Repository Name, and Branch in sequence. The setting of a parameter affects the value of another parameter. If the drop-down list does not contain anything, wait 1 to 2 minutes and set the parameter again.
Figure 6 Selecting the username, repository name, and branch
- Click Next to create a notebook instance.
Viewing a Notebook with a Git Repository
After a notebook instance with a Git repository is created, you can view the repository in different locations, regardless of whether the repository is a public repository or private repository.
- Open the notebook instance to view the code library. After the notebook instance is started up and opened, you can view the code library.
If the code library is downloaded successfully, open the running notebook instance and view the code library on the Jupyter page.
Figure 8 Viewing the code library
If the page shown in Figure 9 is displayed when a project is opened, the git.log file is contained. Open the git.log file. If the file content is the same as that shown in Figure 10, the repository is being downloaded. The download time varies depending on the repository size and network conditions. If the file content is different from that shown in Figure 10, rectify the fault as prompted or submit a service ticket.
Last Article: Creating a Notebook Instance
Next Article: Opening a Notebook Instance




Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.