RUNNERIN
stack
Configuration parameters
RUNNERIN
has no effect has soon as runner.endpoint
configuration is defined (typically on Warp 10 distributed version).
Runners period is defined by the path of the WarpScript file. Typically, /opt/warp10/warpscripts/myapp/60000/myrunner.mc2
will be scheduled every 60 seconds.
RUNNERIN
allow to dynamically schedule the next run, overriding the period defined in the path. See also RUNNERAT
to schedule next run at an absolute time.
RUNNERIN
careless use may bring problems: If a runner is planified every hour, and the execution time is 10 minutes, calling RUNNERIN to reschedule the runner every minute will lead to saturate a runner thread.
That's why the usage is restricted to a capability. Use CAPADD
to add runner.reschedule.min.period
capability from a read or write token at runtime.
runner.reschedule.min.period
capability must contain the minimum of millisecond allowed for RUNNERIN
. See example below. This capability also overrides runner.minperiod
configuration.
Examples are available here on our blog.
RUNNERIN is available since version 2.10.2.
See also
Signatures
Examples
// first, generate a token with 10000 millisecond reschedule capability:
{
'id' 'Token'
'type' 'READ'
'application' 'noapp'
'owner' UUID
'producer' UUID
'expiry' NOW 1 ADDYEARS
'labels' { }
'attributes' {
'.cap:runner.reschedule.min.period' '10000'
}
} 'secret' TOKENGEN
// this is an runner example that write to Warp 10 logs. Copy paste it to /opt/warp10/warpscripts/test/60000/test.mc2
// Activate STDOUT with the debug extension by adding this line to your /opt/warp10/etc/conf.d/99-custom.conf:
// warpscript.extension.debug=io.warp10.script.ext.debug.DebugWarpScriptExtension
//
// Then, look at Warp 10 logs (sudo journalctl -f -u warp10.service)
// The runner will be called every minute, and will speed up to 5 second period during one minute every 5 minutes.
// Wait 10 minutes for resynchronization on current minute, looking at the logs.
"the token with the runner.reschedule.min.period capability"
CAPADD
// if you want to check the capability:
// "runner.reschedule.min.period" CAPGET
NOW ->TSELEMENTS 4 GET 'currentMinute' STORE
$currentMinute 5 % 0 ==
<%
5 s RUNNERIN // next run: 5 seconds after this runner start.
'hello from runner, every 5 seconds' STDOUT
%>
<% 'hello from runner, every minute' STDOUT %> IFTE