How to timeout a long running arcpy operation like (Spatial Join or Identity)

737
2
05-07-2012 09:30 AM
nidhiarora
New Contributor
I have a Spatial join operation which works on huge volume of data. Sometimes it???s done in few minutes but randomly takes couple of hours.
Is there any way to track the timelines of any ongoing   arcpy method, so that the process can be interrupted if the method takes a long time?

regards,
Nidhi
Tags (2)
0 Kudos
2 Replies
AnthonyTimpson2
Occasional Contributor
there is probably a better way but you could always build a timer into the program

import time

write some little catch which triggers and aborts after ten minutes or whatever time frame you had in mind
0 Kudos
curtvprice
MVP Esteemed Contributor
Once a tool has started, your script cannot interact with it. The only approach I can suggest is to launch a script asynchronously using the subprocess module and check on it. Python 2.6 has a new method that allows you to kill processes in Windows in a pretty straightforward way.

I think you may have better luck determining why the process is "randomly" taking a couple of hours and try to trap for that before you start the tool.
0 Kudos