Creating a Job
During routine cloud O&M, O&M personnel typically need to perform specific O&M tasks. However, the public jobs provided by COC may not meet these personalized requirements. If the public jobs provided by COC do not meet your requirements, you can create custom jobs. Jobs include custom scripts, APIs, and process control. Global parameters can be either manually specified or aligned with those configured in the parameter center. Running custom jobs efficiently and securely poses a challenge. By properly configuring and testing custom jobs, you can ensure that they meet specific O&M requirements while keeping system stability and security.
Precautions
Confirm and fill in the risk level of the operation according to the operation procedure.
Creating a Custom Job
- Log in to COC.
- In the navigation pane, choose Resource O&M > Automated O&M.
- In the Routine O&M area, click Job Management. The Job Management page is displayed.
- In the Custom Jobs tab page, click Create Job.
- Set Basic Information.
Table 1 Basic information parameters Parameter
Description
Example Value
Job
Customize a job name based on the naming rules.
Test_Job
Enterprise Project
Select an enterprise project from the drop-down list.
default
Description
Description of a job.
-
Tag
(Optional) Click Add Tag and enter a tag key and a value.
- When you enter a tag key and a value, the system automatically displays all predefined tags associated with the current user.
- A tag key can contain up to 128 characters. It cannot start with _sys_ or a space, and it cannot end with a space. Only letters, digits, spaces, and the following special characters are allowed: _.:=+-@
- A tag value can contain up to 255 characters. It cannot start or end with a space. Only letters, digits, spaces, and the following special characters are allowed: _.:/=+-@
-
- Click Next.
- Select a job template. If no proper template is available, select Customize. Click Next.
- Set Job Orchestration.
- Click
to add a step. - Click the step name or
on the right of the step name to change the step name. Click
on the right of the step name to delete the step. - Click + Add Task to add a task for the step.
- Click + Operation Type to set the operation type of the current task. The operation type can be Cloud service API Task, Controls, or Custom Scripts.
Table 2 Operation type description Operation Type
Description
Cloud service APIs
Start an ECS OS.
You can start ECSs one by one or in batches.
Restart an ECS OS.
You can restart ECSs one by one or in batches.
Change an ECS OS.
You can change the OS of ECSs one by one or in batches.
Stop an ECS OS.
You can stop ECSs one by one or in batches.
Reinstall an ECS OS.
You can reinstall ECSs one by one or in batches.
Create a patch repair task.
You can repair non-compliant patches on the target instance.
Scan a patch.
You can scan the patch compliance of the target instance.
Execute an API.
You can call the OpenAPI of a cloud service registered with API Explorer. If the OpenAPI is called asynchronously, you can use the Wait API atom action to wait until the target object reaches the expected state.
Wait for an API calling result.
It can be used to wait for the target object to reach the expected state. For example, after calling the StartServer API of the ECS using the Execute API atomic action, call the ShowServer API of the ECS using the Wait API atomic action. Wait until the status in the API response becomes ACTIVE, that is, the status is running, then you can confirm that the ECS has been started.
Controls
Review
You can select a shift or an individual for review.
Pause
You can pause a job. To resume a job, you need to click Continue in the service ticket details.
Sleep
You can enable jobs to enter into the sleep mode with this operation. When the configured sleep time arrives, the service ticket continues to be executed.
Custom scripts
Execute a command.
You can run specific commands. The command types include Shell, Python, and Bat. You can customize command content and input parameters.
Execute a script.
You can select a created custom script. For details about how to create a custom script, see Creating a Script.
- Set input and output parameters.
- Set the exception handling option.
You can set whether to terminate the entire job or execute the next step when an error occurs during the execution.
- Click OK.
- Click + Operation Type to set the operation type of the current task. The operation type can be Cloud service API Task, Controls, or Custom Scripts.
- Click a job name or
next to the job name to change the name.
- Click
- (Optional) Set global parameters.
Global parameters can be customized or obtained from the parameter center.
- If you choose to customize global parameters, you need to set the parameter values.
- You can also reference preset parameters and values from the Parameter Center. Note: You need to select the regions where the parameters are located, parameter names, and parameter association modes.
Once the setting is complete, you can obtain the parameter value from ${Parameter name} in the job step.
- Click Next and set more parameters by referring to Table 3.
Table 3 More configuration description Parameter
Description
Risk Level
Select High, Medium, or Low based on service requirements.
Manual Review
After this function is enabled, the job needs to be reviewed. For details about how to review the job, see Reviewing a Custom Job.
Reviewer
Select Shift or Individual.- Shift: Select a shift scenario and a role from the drop-down lists based on the configured values. For details about how to configure a shift, see Shift Schedule Management.
- Individual: Select a reviewer. For details about how to configure a reviewer, see Personnel Management.
Notification Mode
Select a notification channel from the drop-down list.- Default: The notification channel selected in the subscription notification settings of the reviewer is used by default. For details about how to set the default notification channel, see Selecting a Notification Method.
- SMS, WeCom, DingTalk, Phone, Lark, and Email: Notifications are sent based on the information reserved by the reviewer. For details about how to set the reviewer information, see Modifying Personnel Information.
- No notification: The system does not notify any recipient.
- Click OK. The custom job is created.
After a custom job is created, you can view the basic information about the job in the job list and perform operations such as review, modification, execution, and deletion. For details, see Managing Jobs.
Helpful Links
- Custom and public jobs can be executed periodically. For details, see Scheduled O&M.
- COC can create, modify, execute, delete, and query job tickets by calling APIs. For details, see Job Management.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot