It seems that tasks which would have been scheduled during the host where InfluxDB runs on was shutdown don’t get executed after the host is available again. Is there any possibility to still execute these ‘lost’ tasks?
I need to do some calculations on a daily basis but I don’t know when the machine where InfluxDB runs on is available and I can’t influence it. It even might be that the machine is turned off several consecutive days but I would still ned the daily calculations.
Any suggestions how to solve this?
Ooof that’s such a good question.
There technically is a way to automate this. You could write a Flux script that runs over larger intervals and checks the count of expected task runs based on how much data you expect to see. Then you use complicated Flux and httprequest to rexecute…BUT i really recommend against this approach because its incredibly hard to write and a big black box.
This is one of a few major short comings of the task engine. I’d recommend instead using a python client and something like fargate or lambda where you have more observability into failed script executions.
@reitob sorry to be the bearer of annoying news and thanks for your question.
thanks for your clarification.
I think I will try a different solution. Basically, I just need to sum up some points since the last time my task ran and save the result to a new measurement. It’s not super important to have the calculations on a daily basis. So, I thought of creating a daily task which
- checks for the date of the last time the result was written to the measurement,
- sum up the points between this date and now,
- save the result to the measurement
In case the host is running when the task is scheduled everything should be fine. In case it is not running I will create a script which is using the task api endpoint in order to run the task manually. I will execute the script after the host is rebooted so that I should also get the current calculations immediately after the reboot.