6

I have a Python script that runs ArcPy and a model that is imported with a Toolbox.

When directly running the model on ArcMap, it takes 4 plus minutes. It takes about the same time if running in the Windows Command Prompt window. E.g.

Python.exe "{SCRIPT_PATH}"

However, if I run the script in a Windows Scheduled Task, it takes 8 minutes to complete.

One of the processes in the model that makes a big difference is "Tabulate Area". It takes 14 seconds in ArcMap while 44 seconds when run as Scheduled Task!

My environment: ArcMap 10.1, Windows Server 2008 R2 Enterprise, Python 2.7.2.

Anyone else has had the same issue and can tell why?

  • Running in command prompt and running a scheduled task are on the same machine? – Erica Nov 1 '17 at 11:24
  • Exactly the same machine. – alextc Nov 2 '17 at 5:50
4

That is normal, expected behavior. Task Scheduler by default runs tasks at a lower processing and memory priority than processes directly initiated by the user. These two answers should point you in the direction to get this fixed if you want to.

You should of course consider the implications - it could negatively affect other things, like the computer becoming slow when you're working on it, or other things timing out.

https://stackoverflow.com/questions/2427142/is-there-any-way-for-a-win2k8-scheduled-task-to-have-normal-priority-io gives these instructions:

  1. Create the task
  2. Right click on the task and "export" it
  3. Edit the task.xml file that you just exported
  4. You will find a line similar to <Priority>7</Priority>
  5. Change the value to a normal priority (between 4-6). A table of the potential values: [TaskSettings.Priority property][1]
    • A value of 4 will have the same I/O and memory priority as an interactive process. Values of 5 and 6 will have lower memory priority
  6. In the task scheduler, delete the task you initially created
  7. In the task scheduler, in the actions area, import the task from the XML file

https://serverfault.com/questions/151824/process-runs-slower-as-a-scheduled-task-than-it-does-interactively This deals with memory priority, and is a bit wordy to just quote here, but worth a read.

  • Thanks. I tried to change Priority from 7 to 4, but didn't make any difference in terms of processing time. – alextc Nov 2 '17 at 5:50
  • See this link: msdn.microsoft.com/en-us/library/windows/desktop/… You could try increasing priority further, up to 0 which is supposed to be real time priority.Be careful, this could really affect the rest of your system. – PhilippNagel Nov 2 '17 at 12:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.