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.
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.
In the New Script window, complete the following settings, and click Create.
Type: Select the script type (supporting Hive SQL and Shell scripts)
Directory: Select the directory to store the script file
Method: Select Create from Scratch
Name: Enter the script file name
View the created script file, which contains information about the owner and time when the script is created.
Created Hive SQL script file is as follows:
Created Shell script file is as follows:
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.
Editing Hive SQL script:
Editing Shell script:
Running Script¶
When you complete editing the script, you can then run the script, view the running result, and debug the script. The following section uses a Hive SQL script as example to show how to run and debug script.
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.
(Optional) Click Parameter Config from the right edge of the script editor and complete the configuration of parameters for running the script.
Click Run. The script will be run with the specified configuration. The running result will be displayed in the Result section (The running result can display at most 3,000 records).
If you want to run specific lines only, select the code lines, and click Run.
If errors occur, you can debug with the running logs.
Managing Scripts¶
After creating and editing scripts, you can manage the scripts in the script list by the following operations:
Using the operation items above the script list, you can search scripts, create script directories, refresh the script list, and filter the script view.
Create a script quickly by cloning an existing script.
Move scripts among directories or delete scripts.
Note
Only the script owners and the OU owner have the permission to edit the script configuration.