Creating and Writing a Script File

Creating and Writing a Script File in HGrid247-3.5

In HGrid247 version 3.5, scripts are used to automatically run workflows using shell commands.
These scripts are typically used when workflows are to be run on a Big Data engine, such as:

1. Create a Script File

The steps for creating a script are as follows:

2. Naming the Script

In the dialogue: Once the process is complete, the Script Editor will open.


3. Script Editor

Script Editor is a place to write and edit shell scripts .
This editor has two main menus:

Menu Edit

This menu is used to edit the contents of the script.
Available features: Its main function is to help the script editing process easily .

Menu Format

This menu is used to set the script display in the editor.
Available features: This menu does not affect the script execution, only the display in the editor .

4. Writing Scripts Manually

Users can write shell scripts manually in the Script Editor.
Example of a simple script:
    #!/bin/bash
    spark-submit --class workshop.Lab03 workshop.jar input output
This method requires knowledge of:

5. Writing Scripts with Drag and Drop Workflow

An easier way is to use the drag and drop workflow feature .
Steps:
  1. Open the Workflow Tree in the project.
  2. Select the workflow you want to run.
  3. Drag the workflow .
  4. Drop ke Script Editor.
After that, HGrid247 will automatically create a shell command to run the workflow according to the selected engine.
Advantages of this method:

Example Workflow Lab03

For example, there is a workflow:
    Lab03
which is in the package:
    workshop
The workflow and argument sequence are shown in the figure below.



If the Lab03 workflow is dragged into the Script Editor, HGrid247 will generate commands like below:



Once the command appears, the user only needs to:

Example Workflow with Dynamic Parameters

Another example of a workflow is:
    TestRDMSSource
which is in the package:
    workshop
The workflow and argument sequence are shown in the figure below.



This workflow uses the dynamic FROM_ARGUMENT parameter .

If the TestRDMSSource workflow is dragged into the Script Editor, HGrid247 will generate commands like below:




Dynamic parameters mean that the order of parameters is no longer mandatory .
Usage example:
    --dbhost=localhost
    --dbname=testdb
    --table=customer
In this parameter: This makes the script more flexible.

Once the command appears, the user only needs to: