Scheduling Function Execution in Oracle Cloud
Scheduling Functions in Oracle Cloud Infrastructure has arrived. In May 2024, the Resource Scheduler was announced. I tweeted (X-ed) at that time that I was a little disappointed that while it can schedule Compute Instances (VMs) and Databases, it does not trigger function execution on a schedule. I suggested that perhaps it should. And in September 2024 Oracle announced and released this feature: Resource Schedules can now be associated with a Function and every time the schedule fires, the function is executed.
I asked for function scheduling already a long way back. To me, the ability to schedule the execution of a function is quite important. For operational management and maintenance purposes. And for data collection (poll, scrape, ingest, wrangle) and movement. For health checks and production environment tests. For managing complex cloud resources (beyond mere stopping and starting of VMs and databases). I suggested using external schedules on ITFFF and function calls (through API Gateway) in this article (early 2020). And when OCI Monitoring started to included the health checks, I proposed a workaround based on these healthchecks to have functions invoked in a scheduled manner: Using OCI Monitoring Healthchecks to Schedule execution of Serverless Functions on Oracle Cloud Infrastructure (AMIS Blog, January 8th 2020).
So with my long history of asking for scheduled functions, I must be over the moon that now we have it. Right?
Well, I am sure glad that some steps were made towards scheduling function execution. And the functionality that is now on offer does exactly that:
You can define a resource schedule
- with a scheduling interval — as refined as a CRON expression
- associated with a Function
When Resource Scheduler is enabled, it continuously reads the schedulesthat you have created. It takes the actions specified in the schedule at the times you have set, on the resource (the function) that you have selected. You can create any number of schedules that affect the state of the resources in the tenancies that you specify.
It seems just the way it should be. Or does it not?
And I think it is okay. However, there is a big limitation: we cannot configure the input the function in any way. The function is triggered — but it knows nothing about the context in which it is executed. No indication of the name of the resource schedule that causes it to trigger, no values for input parameters, appropriate for this particular execution of the function.
I was quite happy when I first saw the press release that announced the scheduled function execution. However, that initial excitement has waned a little, given these limitations.
Resources
OCI Documentation on Scheduling Function Execution
OCI Documentation on Creating a Schedule with Resource Scheduler (a the time of writing, this documentation only mentions Autonomous Database or (compute) Instance as supported resource types. However the console will also offer the option Functions-Function.
OCI Blog — Control your costs and plan your usage with Resource Scheduler