Select to view content in your preferred language

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

876
2
05-07-2012 09:30 AM
nidhiarora
Deactivated User
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
Regular 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