For a while now (certainly for as long as I've been using it), OpenWhisk/IBM Cloud Functions has had one main way to handle "scheduled" action invocations, the Alarm package. In order to this feature you would use the
alarm feed (part of the alarm package, yes, both share the same name) and specify a CRON string for your schedule.
That works well. But CRON is... well, CRON is a very powerful and flexible system that looks like it was designed by the same people who created regular expressions. I know I can do anything I want with CRON but I absolutely hate doing everything with it.
The good news is that now there is a better way! The Alarm package has a new feed called
interval feed takes (among others) a parameter that specifies the number of minutes to wait between calls. So if you want an action to run every hour? 60. Want it to run once a day? 1440. And that's it. The
interval action also supports an optional
stopDate parameter to let you specify a particular date range for the trigger.
So an example, consider this CRON based trigger:
wsk trigger create periodic \ --feed /whisk.system/alarms/alarm \ --param cron "*/2 * * * *" \
interval version of this would be:
wsk trigger create periodic \ --feed /whisk.system/alarms/interval \ --param minutes 2 \
Also note there is another new feed in this package -
once. This feed takes an argument named date and will only fire one time. Previously developers used the alarm feed and used the
maxTriggers parameter with a value of 1. This is now deprecated (and that will be documented shortly) and
once should be used instead.
I don't think you need to update your existing OpenWhisk actions to change to either of these, but certainly going forward you may want to consider using