Unit 3. Preparing Codes¶
You can use the sample code file provided in this tutorial to calculate the power loss of offshore wind turbines in a notebook instance in AI Lab. This unit introduces how to upload the sample code file to a Notebook instance.
Step 1. Downloading the Code File¶
Download and save this code file
, including the following files.
Number Code File Description 1 power-loss.ipynb A Notebook file with necessary codes to calculate power losses in AI Lab. 2 power-loss.py A Python file with necessary codes to calculate power losses in AI Pipelines. 3 requirements.txt A TXT with requirements for designing calculation pipelines.
Step 2. Creating a Notebook Instance¶
Log in to EnOS Management Console and select AI Studio > AI Lab on the left navigation pane.
Select New Instance on the Notebook Instance tab.
Configure the following information in the New Instance page.
Field Description Instance Name Enter power-loss
.Resource Pool Select the AI-Container resource of your OU. Name/Path Select a pyspark image. CPU Request Enter 0.01
.CPU Limit Enter 0.5
.Memory Request Enter 0.5
.Memory Limit Enter 2
.Workspace Storage Select power-loss-lab, the PVC storage requested in Unit 1. Mode Hadoop PVC Enable this function. Select Confirm to create the notebook instance.
For more information on Notebook instances, see Manage Notebook Instances.
Step 3. Uploading the Code File to the Notebook Instance¶
(Optional) Step 4. Uploading the Code File to Internal Storage¶
If you need to save the code file to internal storage for archiving or backup, or you need to use the file in AI Pipelines operators such as PythonEx, NotebookEx, ShellEx, PythonCode, and ShellCode, upload the code file to internal storage by the following steps:
- Select the plus sign icon (+) from the left panel of the power-loss instance, then select Other > Terminal to open a terminal page in the Launcher tab.
- Run
pip install eap-notebook
in the terminal to install dependencies. - Run the following codes to upload your code file:
eap-notebook push -p power_loss
: add the file to thepower_loss
folder, and replace the file with the same name if the file name already exists.eap-notebook push -r power_loss
: remove all files in thepower_loss
folder then upload the file.
- Run the following codes to view your code file:
eap-notebook ls -p power_loss
: list all files in thepower_loss
folder only.eap-notebook ls -rp power_loss
: list all files in thepower_loss
folder and its sub-folders.
For more information, see Upload Model Code Files to the Internal Storage.