Creating Script from Scratch


This topic introduces how to create and develop script from scratch.

Before You Start

Prepare data sources and data that are used by the script.

Creating Script

Take the following steps to create and develop script from scratch.

  1. Log in EnOS Management Console and select Batch Data Processing > Scripts from the left navigation menu. Then, click + above the script list or click Create Script in the blank page to create script.

  2. In the New Script window, complete the following settings, and click Create.

    • Type: Select the script type (supporting Hive SQL Spark SQL script)
    • Directory: Select the directory to store the script file
    • Method: Select Create from Scratch
    • Name: Enter the script file name
    ../_images/adding_script_from_scratch.png
  3. View the created script file, which contains information about the owner and time when the script is created.

    ../_images/added_script.png
  4. Edit the script in the editor. When you enter script code, the editor will display prompt information in real time. Click Save to save editing changes.

    ../_images/saving_script.png

Running Script

When you complete editing the script, you can then run the script, view the running result, and debug the script.

  1. Click Basic Configuration from the right edge of the script editor and complete the basic configuration for running the script:

    • Owner: Enter owners of the script (who have the permission to edit and use the script).
    • Execution Queue: Select the Batch Processing - Queue resource that is requested through Resource Management.
    • Running Resource: Select the Batch Processing - Container (Design Mode) resource for running the script.
    ../_images/script_configuration.png
  2. (Optional) Click Parameter Config from the right edge of the script editor and complete the configuration of parameters for running the script.

    ../_images/script_params.png
  3. Click Run. The script will be run with the specified configuration. The running result will be displayed in the Result section.

    ../_images/script_result_1.png
  4. If you want to run specific lines only, select the code lines, and click Run.

    ../_images/script_result_2.png
  5. If errors occur, you can debug with the running logs.