I have a python script that uses arcpy that I have scheduled to run using the windows task scheduler on a VM (Windows Server 2012, 64bit)
The script runs every hour and produces some maps in png using data driven pages.
The Windows Task Scheduler successfully runs the python script at the defined times for a few weeks before it decides to just stop.
This seems to be just happening with tasks that are calling python on the VM. I have other tasks that do not seem to be affected by this.
In the python script I log the progress of the script in a text file.
Looking at the history tab of the task I can see the logs generated by the task scheduler from initiating the request, Action started etc. When it stops working I see all the logs that I expect from the Windows task scheduler up to Action Started. However, the python script does not seem to be executed at all as I do not get any logs from the python script in the text file that I log. The next Windows Task scheduler that I see is a task termination that is triggered at the time that I have set in the Settings of the Task (if task runs for x minutes stop it).
I don't know if there is something wrong with my script or if the Windows task is somehow not able to initiate the python script?
The strange thing is that script runs successfully for a few weeks before it decides to just stop for some unexplained reason? I would welcome any ideas on how I can get to the root cause of this issue?
I am unclear whether this is the first time this has happened or whether it repeatedly happens. If the latter, what have you done in the past to get the script working again?
I suggest putting some extra print or logging statements in to tease out where in the script Python isn't working right. Since I assume you are importing ArcPy, what if you comment out the arcpy parts of the script to see if it runs the other parts?
Just to clarify this has happened repeatedly for the past few months. The script runs successfully through the windows task scheduler for a few weeks without any errors.It then just stops with no logs from the script as if it was not invoked by the windows task scheduler.
To get it going again I manually kill the task from the Windows Task scheduler. After that it starts running again and until it stops again after a few weeks. Manually killing the stuck task is not really ideal as the script produces output data that is used in a live production environment.
In the mean time I have added extra logging to see if the script is evening starting at all when it stops running. Hopefully this will give some clues to work with.