Forums

Always-on task

How long does an always-on task take to start? In order to start a simple code with literally print('JAJAJA') in it takes 3 minutes to get prepared and started for the first time.... I am really confused. I could not understand why my code takes so much time in "Starting" without any single action (about an hour). P.s. I do have time that I do not fulfill - about 1.5K seconds all the time.

Does your script contain anything apart from just the print statement? If so, it will start up, print something, and then exit. The system will then restart it, and it will print something and exit again, and so on. The net effect that you will see is that it will always be in a "starting" state because the only time it is "running" is while it's printing -- that is, for a couple of milliseconds between restarts. Most of the time it will be waiting to be restarted. And because it keeps apparently crashing, the always-on system will eventually assume that it's just broken and will slow down the speed at which it restarts it.

Always-on tasks are designed for programs that run for a long time, not for scripts that do something then immediately exit.

ok good point. No and yes. This particular example I made to see if it works whatsoever. I launched the process, it printed that is was starting and in 3 minutes it printed out the output (afterwards it took about 30-50 seconds to relaunch). The other program I have has timers and an infinite while loop. I will double check, but it looks like the first preparation for python code takes quite a long time. Also I tried to estimate the time it takes to "import time" library - on average it takes 5 seconds out of CPU time, which is kind of confusing to be honest.... It is a quite small and simple lib.

I think that anything <1min to startup should be about par for the first startup.

How are you estimating the cpu time? Keep in mind that that is very different from wall time.