All Products
Search
Document Center

CloudOps Orchestration Service:Execute a Function Compute's function as Scheduled

Last Updated:Mar 14, 2024

Scenario

Quickly create a function is a fully managed compute service that can help you quickly build any type of applications or services. With Function Compute, you only need to compose and upload code without worrying about procuring and managing infrastructure resources such as servers. Function Compute prepares computing resources for you, runs your code in an elastic and reliable way, and provides you with features such as log querying, performance monitoring, and alert reporting.

In certain scenarios, you only need to run the code uploaded to Function Compute at the specified time and view the result of each code execution. Function Compute alone cannot run your code as scheduled while providing the result of each code execution. Therefore, you need a service that allows you to run code in Function Compute as scheduled and view the result of each code execution.

CloudOps Orchestration Service (OOS) is such a service. It provides the scheduled O&M feature. Based on a timer, this feature runs tasks as scheduled by triggering public or custom templates. By using the scheduled O&M feature to run the public template ACS-FC-InvokeFunction provided by OOS, you can run code in Function Compute as scheduled and view the result of each code execution.

Configuration process

First, you need to create a function in Function Compute. For more information, see Quickly create a function. After the function is created, select the public template ACS-FC-InvokeFunction provided by OOS and run the template by using the scheduled O&M feature of OOS. In the template, you only need to set parameters related to Function Compute for calling the specified function.12122522

Procedure

  1. Log on to the Function Compute console and create a function, such as the test function shown in the following figure.

  2. Log on to the OOS console.

  3. In the left-side navigation pane, click Scheduled O&M.

  4. In the Set Scheduled Task section, set Scheduled Task Type. If you select Executed Once at the Specified Time, you only need to set Execution Time. If you select Executed Periodically, set Execution Frequency,Time Zone for Periodic Execution, and End Time for Period Execution.

  5. In the Select Template section, search for the public template ACS-FC-InvokeFunction and select it.

  6. In the Configure Parameters section, set the parameters as required.

  7. Click Execute Now. Your function in Function Compute is called as scheduled. As shown in the following figure, you can click Scheduled Execution List in the execution details to view the latest execution time and execution history.

  8. In the left-side navigation pane, click Executions. On the Executions page that appears, find the target execution and click View Child Execution in the Actions column. Then, Click View Child Execution again and click Details in the Actions column. The execution result of the function appears.

Appendix 1: Scheduled O&M

  1. OOS provides the scheduled O&M feature. For more information about how to use this feature, see Perform scheduled O&M.

Appendix 2: Create a function in Function Compute

  1. For more information about how to create a function in Function Compute, see Quickly create a function.