Forums

Why does my scheduled task gets killed once a day?

I have a scheduled task that runs continuously and the task is to check for a presence of files (which I call as request files) in a certain directory. If these request files are present, it will call an external program to run the instructions in these request files. This works as expected.

However, I noticed my scheduled task, for some reason, gets killed roughly once a day, even though there are no request files (I am still developing my web app, so I know when there are request files). The scheduled task is activated again after about 1 hour (since I schedule it to run every hour) -- only to be killed at least once a day.

Here is what I see in the tasks log:

2018-03-03 18:01:08 -- Completed task, took 29.00 seconds, return code was 0.
2018-03-03 19:01:00 -- Completed task, took 23.00 seconds, return code was 0.
2018-03-03 20:01:14 -- Completed task, took 20.00 seconds, return code was 0.
2018-03-03 21:01:18 -- Completed task, took 33.00 seconds, return code was 0.
2018-03-03 22:01:15 -- Completed task, took 29.00 seconds, return code was 0.
2018-03-04 00:01:37 -- Completed task, took 26.00 seconds, return code was 0.
2018-03-04 01:01:33 -- Completed task, took 33.00 seconds, return code was 0.
2018-03-04 02:01:23 -- Completed task, took 28.00 seconds, return code was 0.
2018-03-04 03:01:28 -- Completed task, took 29.00 seconds, return code was 0.
2018-03-04 04:01:25 -- Completed task, took 31.00 seconds, return code was 0.
2018-03-04 05:01:27 -- Completed task, took 30.00 seconds, return code was 0.
2018-03-04 06:01:43 -- Completed task, took 22.00 seconds, return code was 0.
2018-03-04 07:01:34 -- Completed task, took 27.00 seconds, return code was 0.
2018-03-04 08:01:44 -- Completed task, took 25.00 seconds, return code was 0.
2018-03-04 09:01:27 -- Completed task, took 31.00 seconds, return code was 0.
2018-03-04 10:01:52 -- Completed task, took 34.00 seconds, return code was 0.
2018-03-04 11:01:30 -- Completed task, took 41.00 seconds, return code was 0.
/bin/bash: line 1: 12881 Killed                  python /bin/run_scheduled_task.py 'TZ='"'"'Asia/Kuala_Lumpur'"'"' python3.6 /...request.py'

....

/bin/bash: line 1: 31162 Killed                  python /bin/run_scheduled_task.py 'TZ='"'"'Asia/Kuala_Lumpur'"'"' python3.6 /...request.py'
2018-03-11 12:08:04 -- Completed task, took 43636.00 seconds, return code was 137.

What is the problem? Thanks for any help.

We do currently restart the task servers etc- ie. your scheduled tasks will get killed periodically. See this for a better solution. We are also working on a feature that runs tasks "forever", but it is not open to the public yet.