(Optional)Unit 3. Preparing Codes


In this tutorial, the sample code files for predicting turbine engine temperature rises already exist in EnOS. You can skip this unit and use the provided sample code files and sample pipeline for prediction tasks. However, if you need to walk through the process on how to upload files to EnOS for future uses, or you want perform the steps in Designing a Pipeline from Scratch, refer to this unit to upload your code files.

Step 1. Downloading Code Files


Download and save these code files, including the following files.


Number Code File Description
1 Dockerfile A file with necessary codes to build a Docker image.
2 ModelExplorer.ipynb A Notebook file with necessary codes to build predicting models.
3 Train.ipynb A Notebook file with necessary codes for model training.
4 prepare_predict_history_data.py A Python file with necessary codes to process history data.
5 process_results.py A Python file with necessary codes to get predicting results.
6 requirements.txt A TXT file with requirements for processing model files in AI Lab.
7 requirements_pipeline.txt A TXT file with requirements for designing prediction pipelines.
8 requirements_predict.txt A TXT file with requirements for model predicting tasks.
9 requirements_train.txt A TXT file with requirements for model training tasks.

Step 2. Creating Notebook Instance


  1. Log in to EnOS Management Console and select AI Studio > AI Lab from the left navigation pane.

  2. Select New Instance on the Notebook Instance tab.

  3. Configure the following information in the New Instance page.


    Field Description
    Instance Name Enter temp-rise.
    Resource Pool Select the AI-Container resource of your OU.
    Name/Path Select a keras image.
    CPU Request Enter 0.01.
    CPU Limit Enter 1.
    Memory Request Enter 0.5.
    Memory Limit Enter 2.
    Workspace Storage Select temp-rise, the PVC storage requested in Unit 1.
    Mode Hadoop PVC Disable this function.


  4. Select Confirm to create the notebook instance.


For more information on Notebook instances, see Manage Notebook Instances.

Step 3. Uploading Code Files


  1. Select the temp-rise instance from the instance list.
  2. Select the folder icon i_folder to add a new folder and enter temp_rise as the folder name.
  3. Open the temp_rise folder you created on the temp-rise instance page.
  4. Select the up arrow icon i_upload to upload all files you unzipped.

Step 4. Uploading Code Files to Internal Storage


If you need to store the code files 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:

  1. Select the plus sign icon (+) from the left panel of the temp-rise instance, then select Other > Terminal to open a terminal page in the Launcher tab.
  2. Run pip install eap-notebook in the terminal to install dependencies.
  3. Run the following codes to upload your code file:
    • eap-notebook push -p temp_rise: add the file to the temp_rise folder, and replace the file with the same name if a file name already exists.
    • eap-notebook push -r temp_rise: remove all files in the temp_rise folder then upload files to the folder.
  4. Run the following codes to view your code file:
    • eap-notebook ls -p temp_rise: list all files in the temp_rise folder only.
    • eap-notebook ls -rp temp_rise: list all files in the temp_rise folder and its sub-folders.


For more information, see Upload Model Code Files to the Internal Storage.