Since version 2.11.0 of Warp 10, a runner can decide when to reschedule itself. Dynamic scheduling is now really easy within WarpScript.

Warp 10 2.11.0 (released in August 2022) comes with two new functions to reschedule runners from the runner code itself. It is very convenient to program a task at a fixed hour or to change the period up to events. These functions are protected by a capability.
Read this previous article about Warp 10 scheduler secrets |
runner.reschedule.min.period capability
As a sysadmin, you do understand the risk to let someone schedule tasks within a small period. If the task lasts longer than its period, it will be rescheduled right after, and monopolize a thread. So, dynamic rescheduling is constrained by a minimum period encrypted in a token you will give to WarpScript developers.
Since 2.11.0, you can use TOKENGEN without the need to activate the extension or define a secret.
First, save the following script as /opt/warp10/tokengen-runnercap.mc2
:
Then, log in as warp10 user, and execute the following command:
The output should contain your token. It is time to test it:
It should return 5000.
Create a standard 1-minute runner
For an easier understanding of runners' behavior, we will print debug messages to the Warp 10 process log output.
Since Warp 10 3.0, debug is built-in and capability protected. To use STDOUT
, you just need a token with the debug capability set to an empty string.
If you still work with Warp 10 2.x, you need to follow these instructions. Enable the debug extension in Warp 10 by adding this line to your personal configurations (/opt/warp10/etc/conf.d/99-personalconfig.conf
), and restart Warp 10:
warpscript.extension.debug = io.warp10.script.ext.debug.DebugWarpScriptExtension
Once done, you can save the following WarpScript to a file that will be scheduled every minute: /opt/warp10/warpscripts/test/60000/runnertest.mc2
:
In another terminal, monitor the logs with tail -f /opt/warp10/logs/warp10.log
. You should see your message every minute in the logs:
Basically, your runner is executed:
- When Warp 10 starts
- Every fixed period, defined by the script path (here 60000 ms)
So, it is not obvious for example to trigger a script at 1 o'clock AM every day… Except if you test the current time every minute, and STOP if it is not exactly 1:00, or if you wake up to restart Warp 10 at 1 o'clock.
The period is not perfectly exact too. The system will slowly drift, with a few milliseconds error at each reschedule.
Read more about scheduling Warp 10 tasks with runners, like down-sampling, archiving, deletions, computations, and so on. |
Speed up or slow down scheduling
Imagine Warp 10 is monitoring a device. Every minute, a runner checks several parameters and sends an email if there is a problem.
Of course, the failure can last more than one minute… And you do not want to receive one email per minute for the same problem. RUNNERIN
allow to override the period punctually:
The output is:
By default, the period is one minute and is randomly extended to 5 minutes.
Execute a WarpScript once every Warp 10 restart
Runners will run as soon as the storage is ready. If you do want to log something at each Warp 10 restart, but never after, you can use MAXLONG RUNNERIN
to completely disable a runner.
Postpone next execution to a fixed hour
Since the latest Warp 10 release, the $runner.execution.count variable makes the task to detect the first execution very easy. So we can build a runner that detect the first execution, reschedule itself to 1:00AM, and keep running exactly at 1:00AM the next day.
So far, the only way to do this was to use cron, or a systemd timer, to run a WarpScript with curl. But cron or other schedulers cannot reschedule up to execution result. RUNNERAT
brings a native solution, with more flexibility, as you can choose to reschedule anytime.
Note that the previous example does not completely override the period defined in the script path… If the code fails before reaching RUNNERIN and RUNNERAT, the script will be rescheduled 1 minute later. If you want to make sure this does not happen, use TRY
function, display the stack trace in the catch macro, and reschedule in the finally macro. This will mimic a cron or a systemd timer.
Priority
So, WarpScript runners' dynamic scheduling depends on:
The Warp 10 standalone scheduler will apply the following rules:
RUNNERIN
overrides the initial period.- If
RUNNERAT
is used, the script is rescheduled to the closest in time betweenRUNNERAT
time and "script start + initial period" time.
That's why RUNNERAT
alone can speed up a runner, but you need MAXLONG RUNNERIN
to slow down a runner.
Conclusion
RUNNERAT
and RUNNERIN
make dynamic scheduling easy, you do not need to maintain complex code or use third-party schedulers. If you do not know everything about runners (basics, special variables, NONCE…), you can read this previous article.
Read more
WarpScript
Kafka Streams
Thinking in WarpScript – Fetch data within a temporal or a count range
2022 review of the Warp 10 platform

Electronics engineer, fond of computer science, embedded solution developer.