I am looking for a way to access a GP tool running in a Python script to be able to see how much of the job has already been done.

I have found SetProgressor function, but this one is available only when running script tools via ArcGIS Desktop GUI. I am in contrary interested in obtaining the information on the progress via the code. This is to be able to track on the execution of the tool (this will be reported to a user which has triggered running the code). I don't run the code inside the ArcGIS Desktop application session.

So, for instance, when calling the Buffer GP tool on a polygon feature class (via arcpy.analysis.Buffer), I want to get an estimate from the tool after several seconds how much (in %) of the work was already done and this information should be possible access via the code.

  • Probably ought to be merged, since this Answer is more complete. – Vince Sep 5 '19 at 20:23

You can't get this information as the Python script will block until the tool has finished running.

| improve this answer | |
  • 2
    ArcGIS server geoprocessing services can be called asynchronously. However, I doubt that it is possible to get any progress via the results-object when polling the status of the job from standard tools. – Stefan Oct 16 '14 at 7:37
  • 1
    @Stefan True, the result object doesn't include any way to access the progressor. – Jason Scheirer Oct 16 '14 at 14:48
  • @JasonScheirer, thank you. Any other suggestions on how this kind of logic could be implemented with arcpy/Python? Or at least something close? – Alex Tereshenkov Oct 17 '14 at 7:20
  • @AlexTereshenkov you could go the comtypes and invoke GP tools via ArcObjects. If you implement your own TrackCancel object you get feedback as the tool executes. You could also look into the GeoprocessorEvents sink. – Jason Scheirer Oct 17 '14 at 14:42

You cannot get current status of the tool execution when it has been executed in Python (arcpy). The tool would have to execute Asynchronously, not blocking your application to support this. If it was Async you'd assign the execution call to a variable and check the variable status. Thats exactly how a GP Service works. But your scenario is calling a tool in Desktop, and this execution mode is essentially Synchronous: you execute the tool and your script "freezes" till its done.

Looking at multiprocessing or similar techniques will not help. The thread or job you launch won't return anything until the tool is finished.

In short, percentage complete is a capability of the UI.

| improve this answer | |

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.