Scheduling Function Execution in Oracle Cloud

Quick Take

Oracle Cloud Infrastructure Resource Scheduler can invoke deployed OCI Functions on recurring schedules, removing the need for external schedulers or health-check workarounds in many cases. This article explains why scheduled functions matter for maintenance, data collection and operational tasks, and contrasts the built-in scheduler with earlier solutions. Scheduling became available for OCI Functions in September 2024. It still requires appropriate identity and access policies; the older walkthrough also highlights restrictions around invoking a function with custom input. Check current OCI documentation for supported scheduling options and permissions.

Source: Oracle: Support for scheduled functions.

Using the built-in function scheduler today

Oracle’s Scheduling a Function guide explains how to create a Resource Scheduler schedule from OCI Functions or the Resource Scheduler console. A schedule requires a dynamic group containing the schedule and a policy that permits the function invocation; without suitable IAM, the schedule alone cannot run the function. The current overview covers recurring maintenance and periodic processing. The original article below describes the initial September 2024 release and its then-observed restrictions; do not assume those limitations still apply unchanged.

For a different pattern of running cloud maintenance commands, see management jobs with OCI DevOps Shell stages. Scheduling a function and running a pipeline shell stage are different execution models.

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.

OCI Resource Scheduler overview showing a scheduled function invocation

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 Function Execution in Oracle Cloud 0*goCYipkoa2R4VWJa

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

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.