I want to do some task 10 times every hour. Or 10 times every day, or 3 times every day etc etc. I want this to be dynamic so I can just give 2 parameters, like:
randomly do the task be 10 times during a day.
I must keep track of how many times the task has been done, so its stops to do it after it reached "times"
Just to make it clear, the 10 times the task must be done, must be at 10 random times
What would be a nice way to do this?
I will hit some function every now and then (completely random), then instantly i must know if the task will run or not. So I cant used celery that will so something 10 times in the day. I need to instantly know if its YES or NO.
Isn't it sufficient to run a cron job once a minute which will make a decision whether to perform your task or not and if so, do it? You could keep a file which contains the number of times it's done it and use that to stop if don't need it anymore.