I have a periodic task for data purging which run once a day.
I want that task to run only for 1 hour. If the duration of processing that task is more than 1 hour, then expire that task. It will run again the next day for 1 hour.
I would like to do this is because if the traffic is high then that particular cerely task keeps on running for 10-15 hours.
You can set up the task time limits as per documentation
If you are going to set it on particular task you can use
task_time_limit
or task_soft_time_limit
depending on your usage characteristics