Function Compute 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.
Operation 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.
- Log on to the Function Compute console and create a function, such as the test function shown in the following figure.
- Log on to the OOS console.
- In the left-side navigation pane, click Scheduled O&M.
- 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.
- In the Select Template section, search for the public template ACS-FC-InvokeFunction and select it.
- In the Configure Parameters section, set the parameters as required.
- 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.
- 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
- OOS provides the scheduled O&M feature. For more information about how to use this feature, see Scheduled O&M.
Appendix 2: Create a function in Function Compute
- For more information about how to create a function in Function Compute, see Use the console to create a function.