Job Template
The system provides templates related to SQL jobs. You can modify the SQL statements in an existing template to create your required job, which saves the time for compiling SQL statements. Alternatively, you can customize a job template as you need, facilitating future modification. You can create and manage templates on the Job Template page.
This section describes the following:
- Template list
- Creating a Template
- Creating a Job Based on a Template
- Viewing Template Details
- Modifying a Template
- Deleting a Template
Template list
All custom templates are displayed in the custom template list on the page. Table 1 describes parameters involved in the custom template list.
| Parameter | Description |
|---|---|
| Name | Name of a template, which has 1 to 64 characters and only contains letters, digits, hyphens (-), and underlines (_). |
| Description | Description of a template. It contains 0 to 512 characters. |
| Created | Time when a template is created. |
| Updated | Latest time when a template is modified. |
| Operation |
|
| Button | Description |
|---|---|
| Create Template | Click Create Template to create a custom template. |
| Delete | Click Delete to delete one or more custom templates. |
|
| In the search box, enter the template name and click |
| Search by Tag | Search for the custom templates based on the tag. For details, see Searching for Job Templates by Tag. |
|
| Click |
Creating a Template
You can create a template using any of the following methods:
- Creating a template on the page
- In the left navigation pane of the CS management console, click Template Management, Custom Templates.
- Click Create to switch to the dialog box.
- Specify Name and Description. Figure 1 Creating a template
Table 3 Parameters related to the template configuration Parameter
Description
Name
Name of a template, which has 1 to 64 characters and only contains letters, digits, hyphens (-), and underlines (_).
NOTE:The template name must be unique.
Description
Description of a template. It contains 0 to 512 characters.
- (Optional) Add tags for the job template. In this step, configure the parameters in the following table as required. The tags are optional. If you do not need tags, skip this step.
Table 4 Tag parameters Parameter
Description
Tag key
You can perform the following operations:
- Click the text box and select a predefined tag key from the drop-down list. NOTE:
To add a predefined tag, you need to create one on TMS and select it from the Tag key drop-down list. You can click View Predefined Tag to enter the Predefined Tag page of TMS. Then, click Create Tag to create a predefined tag. For details, see section Creating Predefined Tags in the Tag Management Service User Guide.
- Enter a tag key in the text box. NOTE:
A tag key contains a maximum of 36 characters. The first and last characters cannot be spaces. The following characters are not allowed: =*,<>\|/
Tag value
You can perform the following operations:
- Click the text box and select a predefined tag value from the drop-down list.
- Enter a tag value in the text box. NOTE:
A tag value contains a maximum of 43 characters. The first and last characters cannot be spaces. The following characters are not allowed: =*,<>\|/
- A maximum of 10 tags can be added.
- Only one tag value can be added to a tag key.
- The key name must be unique in the same resource.
- Click the text box and select a predefined tag key from the drop-down list.
- Click OK to enter the page. Figure 2 Editing a job template
- In the SQL statement editing area, enter SQL statements to implement business logic. For details about how to compile SQL statements, see the Cloud Stream Service SQL Syntax Reference.
- After the SQL statements are compiled, click Save.
After a template is created successfully, it will be displayed in the custom template list. You can click Create Job in the Operation column of the template you have created to create a job based on the template. For details about how to create a job, see Creating a Flink Streaming SQL Job.
- Creating a template based on an existing job template
- In the left navigation pane of the CS management console, click Template Management, Custom Templates.
- In the row where the desired template is located in the custom template list, click Edit under Operation to enter the page.
- Click Save As.
- In the Template Save As dialog box that is displayed, specify Name and Description and click OK.
- Creating a template using a created job
- In the navigation tree on the left pane of the CS management console, choose to switch to the Job Management page.
- On the Job Management page, click Create to switch to the Create Job dialog box.
- Specify parameters as required.
- Click OK to enter the page.
- After the SQL statement is compiled, click More > Set as Template.
- In the Set as Template dialog box that is displayed, specify Name and Description and click OK.
- Creating a template based on the existing job
- In the navigation tree on the left pane of the CS management console, choose to switch to the Job Management page.
- In the job list, locate the row where the job that you want to set as a template resides, and click Edit in the Operation column.
- Click More > Set as Template.
- In the Set as Template dialog box that is displayed, specify Name and Description and click OK.
Creating a Job Based on a Template
You can create jobs based on sample templates or custom templates.
- In the navigation tree on the left pane of the CS management console, choose Template Management to switch to the page.
- In the row where the desired template is located, click Create Job under Operation. For details, see Creating a Flink Streaming SQL Job. Figure 3 Creating a job based on a template
Viewing Template Details
- In the navigation tree on the left pane of the CS management console, choose Template Management to switch to the page.
- In the Name column of the sample template list or custom template list, click the name of the template you want to view.
The template description and SQL statements involved in the current template are displayed.
- (Optional, only available for custom templates) Click Audit Log to view the operation logs of the current custom template.
For details about audit logs of a template, see Viewing Job Template Audit Logs.
- (Optional, only available for custom templates) Click Tags to view the tag key and tag value of the current template.
For details about template tags, see Managing Job Template Tags.
- (Optional, only available for custom templates) Click Edit in the upper right corner. You can edit the custom template on the page.
Modifying a Template
You can modify created custom templates as required. Sample templates cannot be modified.
- In the left navigation pane of the CS management console, click Template Management, Custom Templates.
- In the row where the template you want to modify is located in the custom template list, click Edit in the Operation column to enter the page.
- In the SQL statement editing area, modify the SQL statements as required.
- (Optional) Click
to modify the template name and description. - Click Save.
You can access the page through the page. The procedure is as follows:
- In the custom template list, click the name of the template you want to modify to switch to the Template Details page.
- Click Edit to enter the page.
Deleting a Template
You can delete a custom template as required. The sample template cannot be deleted. Deleted templates cannot be restored. Exercise caution when performing this operation.
- In the left navigation pane of the CS management console, click Template Management, Custom Templates.
- In the custom template list, select the templates you want to delete and click Delete in the upper left of the custom template list.
Alternatively, you can delete a template by performing the following operations: In the custom template list, locate the row where the template you want to delete resides, and click Delete in the Operation column.
- In the displayed dialog box, click OK.
Last Article: Monitoring a Job
Next Article: Cluster Management


Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.