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.
A Resource Schedule has a schedule (CRON expression) and a resource attachment — in this case to a Function.
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).
Scheduling execution of a function using OCI Monitoring Healthchecks and API Gateway — a bit of a cumbersome workaround. The Healthcheck is configured with a URL that can contain path and query parameters. Additionally, the API Gateway route can map these parameters to the function invocation (and add its own statically defined parameters as well). All of this is not available with Resource Scheduler’s Function execution — which only triggers the function without any parameters provided to it.
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