I have a standard geoprocessing toolbox that I am exposing as a geoprocessing service. The tools in this toolbox are plain 'ol python scripts. All of this is being done in ArcGIS 9.3.1.
As a standalone toolbox run in the desktop environment, all of the tools execute flawlessly. However, as soon as I try to execute the same 'tools' as exposed through the geoprocessing service, all type of weird stuff happens. Among other things, the script stops executing abruptly, without throwing any type of error. In turn, the client never gets a notification of success or failure...
After many days of head scratching, I have become aware of a property of script tools - the 'Run Python script in process' option. From ESRI's standard web help:
Running in-process requires that all modules loaded with the Python import directive have the necessary logic to enable them to run in-process. All standard Python libraries, such as os, string, and time, have the necessary logic. However, non standard modules obtained from third parties may not have the necessary logic to run in-process. If you are experiencing unexplainable problems when your script runs, try unchecking the in-process option and running your script again. If the problem goes away when running out-of-process, then there is most likely an issue with one of the modules you imported. In this case, leave the option unchecked.
Sure enough, my scripts do make use of 3rd party libraries, so I was thinking I finally figured it out - uncheck that option and all my problems should disappear. Well, if I uncheck the option and expose tool as gp service - it fails immediately with the "Error Executing Task Error Code 500". Instead of making half-way through the script - it just bombs immediately.
Does anyone know if it is possible to run geoprocessing services "out of process"?