Can background processing be enabled/disabled in arcpy?

6536
8
Jump to solution
09-07-2016 11:18 AM
Zeke
by
Regular Contributor III

Pretty much what the post title says. I have some python scripts which require background processing to be enabled, other disabled. I know this can be set in tool properties, but these are just stand alone scripts. Haven't been able to find any info one way or the other. Thanks.

1 Solution

Accepted Solutions
DanPatterson_Retired
MVP Esteemed Contributor

the only reference is covered here, and it is to ensure that 64 bit is being used

Background Geoprocessing (64-bit)—Help | ArcGIS for Desktop 

there is no specific arcpy function that I can see

View solution in original post

8 Replies
DanPatterson_Retired
MVP Esteemed Contributor

the only reference is covered here, and it is to ensure that 64 bit is being used

Background Geoprocessing (64-bit)—Help | ArcGIS for Desktop 

there is no specific arcpy function that I can see

BruceHarold
Esri Regular Contributor

You can call 64bit arcpy from a standalone script, the trick is to set PYTHONPATH to the 64bit site-packages directory then start a subprocess that inherits the environment variable and runs 64bit.

Similar to the code in this sample:

arcgis.com/home/item.html?id=b3c7c6273ef54e91aa57a073aa873eca

JanHeckman
New Contributor II

I would like to be able do disable background processing from a standalone python script, so I can run resource hungry old (9.3 era) scripts which still have some VB in them. Of course I should revise scripts (there are plenty...)

0 Kudos
JoshuaBixby
MVP Esteemed Contributor

To me, "standalone python script" implies running the script outside of ArcGIS Desktop, e.g., calling a *.py file directly from a Python interpreter.  Is that what you are doing, or are you wanting to run it from within ArcGIS Desktop, like from the interactive Python window?

0 Kudos
JanHeckman
New Contributor II

Joshua,

Running scripts from the commandline is what I sometimes do, so I can run several in parallel.

I must say these are old habits and I may have to change them.

0 Kudos
JoshuaBixby
MVP Esteemed Contributor

I don't think there is anything wrong or dated with running scripts from the command line, I do it quite a bit, and I think lots of other folks do as well.  Sometimes I find integrating scripts into the ArcGIS ecosystem (Python toolboxes, etc...) not worth the effort.

Anyhow, if you are running scripts from the command prompt or directly from an interpreter, i.e, not through ArcGIS client, then background processing doesn't really exist.  If you have 64-bit Background Geoprocessing installed and run the script using the 64-bit Python interpreter, then the script uses 64 bit tools.  If you have 64-bit Background Geoprocessing installed and run the script using the 32-bit interpreter, the script uses 32-bit tools.  The Background Processing setting under Geoprocessing options applies to running scripts within the ArcGIS client (ArcMap, ArcCatalog, etc...)

JanHeckman
New Contributor II

Right, I have the same opinion about running scripts from commandline and I understand that the setting is for the client. However, I sometimes get an abnormal program termination (C++ runtime) when using Pyton 32 bit, so I then explicitly use C:\python26\arcgisx6410.5\python.exe. Which will give me an error when it finds anything smelling like VB.

I found arcpy.env.parallelProcessingFactor='0' (which I included in a script). I do not know if it helps, since I replaced the offending tool calls by cursor-methods.

I will certainly give it another try - when back from holiday.

0 Kudos
JoshuaBixby
MVP Esteemed Contributor

If you can provide a specific example, I might be able to offer something more specific in terms of feedback.

0 Kudos