Select to view content in your preferred language

Python 32 & 64 bit automation in scheduled task

1075
7
04-18-2013 07:15 AM
TristanKnowlton
Frequent Contributor
I have a process that runs the 64-bit version of python as well as the 32-bit version.  The processes run on a machine with both ArcGIS Server and ArcGIS Desktop installed.  The 64-bit processes stop/start map services on the server while the 32-bit process does some database joins, db analyze, deletion, copying, and compressing. 

I need this process to be automated and would like them to run under a single scheduled task on Windows Server 2008.  I have ran the pythons scripts successfully individually as well as combining the processes into a single python script.  The scripts work when run from Python IDLE, the command line, as well as from batch (.bat) files.  However, they only way they will run in scheduled tasks is if they are each in a separate scheduled tasks.  I tried to created a separate batch file for each process and then call all three batch files from another batch file, didn't work.  I tried 1 batch file that calls each version of python individually with each script, didn't work.

I can't call python within the scheduled task with the .py script as the argument because I need to call Python's two versions: C:\Python27\ArcGISx6410.1\python.exe & C:\Python27\ArcGIS10.1\python.exe.

The following batch file executes the first script but will not execute the second or third scripts:

ECHO ON

C:\PYTHON27\ArcGISx6410.1\python.exe D:\GIS\Automation_Files\PythonScripts\StopServices.py

C:\PYTHON27\ArcGIS10.1\python.exe D:\GIS\Automation_Files\PythonScripts\ParcelJoin.py


C:\PYTHON27\ArcGISx6410.1\python.exe D:\GIS\Automation_Files\PythonScripts\StopServices.py 

pause



Thanks!
Tags (2)
0 Kudos
7 Replies
MathewCoyle
Honored Contributor
Is there a specific reason you are mixing 32-bit and 64-bit geoprocessing environments?
0 Kudos
TristanKnowlton
Frequent Contributor
In order to do the geoprocessing I need to break the locks on the data that my ArcGISServer account places on the data.  To do this, I need to stop the map services that contain the data that I am working on.  I believe the 64-bit version of python is needed to run those since Server is 64 bit.

Thanks!
0 Kudos
MathewCoyle
Honored Contributor
You can upgrade ArcGIS for Desktop to use 64-bit geoprocessing as well.
0 Kudos
TristanKnowlton
Frequent Contributor
Thanks Mathew.  I looked into it and see that it will not work with OLEDB connections.  One of my data sets includes a connection via OLEDB.  Looks like that kills that option.
0 Kudos
TristanKnowlton
Frequent Contributor
Actually after thinking about that for a bit, I could do the geoprocessing involving the OLEDB connection on another machine at another time since it is not a critical piece of the puzzle anyway.  I'll upgrade to 64-bit processing on my server.

Thanks for the help!
0 Kudos
KevinHibma
Esri Regular Contributor
Or you could do all the processing in 32bit.
You dont have to use 64 bit Python to stop / start services. Well I can't imagine any particular code that would be 64bit dependent. Yes, Server is 64bit, but if you're making REST-Admin calls with URLLIB or something similar, the bits dont matter, its just HTTP calls.
0 Kudos
by Anonymous User
Not applicable

This post is seven years old, hopefully you found a solution. If not, or for those with same problem, see this Esri KB article below. Basically you need to add Call in your batch file for each line. The KB article linked below has the details on why.

Problem: Batch files exit after the first Python command 

0 Kudos