ArcGIS Pro - Python toolbox tools take a long time to run

5075
12
Jump to solution
12-08-2015 12:12 PM
JeremyBracone
New Contributor II

Geoprocessing python tools from a python toolbox take a long time to start and then remain in the "Updating" phase after finishing for a long time (more than an hour).  Even a default tool that does nothing takes a long time to run and remains in the "updating" state, sometimes not even finishing.  I am running ArcGIS Pro 1.1 and am wondering what the problem might be.

This same python tool runs fine from ArcMap and also runs fine as a stand-alone script using the Python 3 interpreter.

I have had this same problem on multiple computers and had made ArcGIS Pro useless to me for running python tools.

12 Replies
JeremyBracone
New Contributor II

Thanks for this tip.

0 Kudos
JeremyBracone
New Contributor II

We have identified what caused this behavior and will be submitting a bug report to ESRI.

There seems to be an issue with setting arcpy.env.addOutputsToMap to False in a python script tool.  If that line is run in the python tool, tools will not complete after the script finishes.  This behavior will persist for all geoprocessing script tools (and possibly normal gp tools) for the rest of the session.

Removing this line from all python toolboxes in the project and re-opening the project resolves the problem.

KevinGabelman
New Contributor II

This is an older post, but I am having this issue with scripts that I run as Toolboxes. I am NOT using the arcpy.env.addOutputsToMap env at all. 

I have a module that outputs time results for several tools and functions. The same tool in Arc, using only basic Python and arcpy modules, can take 2-5 times longer to run than when run from outside Arc on the same datasets. 

The scripts themselves are around 1000 lines of code and contain multiple functions within one main class, as well as the "stopwatch" class and also, one "static tools" class that I use as a sort-of basic conversion calculator (get specs for a Feature Dataset; get needed standard spatial references; convert text to Bool; create a layer in-memory, etc).

What I am looking for, more than anything, is any advice or feedback that would tell me things like:

  • Does the length of a sub-functions code matter when maximizing Toolbox performance?
    • e.g. is it better to split larger functions into smaller ones, or vice-versa?
  • Are there penalties for storing things in-memory (assuming we have plenty?)

Please, do not offer things like, "store your stuff locally." I know about this. All of these test scripts are running on a Threadripper + 3080, which has access to a dedicated write-drive and reads from an nvme RAID10 array.

0 Kudos