Python Toolbox Tool and Creating a Geoprocessing Service

2954
13
Jump to solution
10-02-2012 07:12 AM
ChanningDale
New Contributor III
Hello all,

I've created a custom tool in a Python toolbox and want to publish it as a geoprocessing service.  It has three parameters, and it uses Make Feature Layer tool, Select By Location Tool, and the Execute Reviewer Batch Job tool.  It runs perfectly in Desktop.

Yet, when I publish it and go to run it as a service, ArcGIS Server says that it runs successfully, but I get no results back.  I honestly don't think that any of my code runs, even though ArcGIS Server says that it completed.  I even started picking apart my tool to see if there was an issue with certain parts, but even when I tear it down to something extremely simple, I get nothing from ArcGIS Server.  I've registered the databases and folder locations that I'm using too with Server.

Has anyone else been having issues trying to publish their geoprocessing tools to services?  Could I get some help?
Tags (2)
0 Kudos
13 Replies
KevinGooss
Occasional Contributor
not sure about the data referencing.
I would make sure the service you are publishing is synchronous just to start out.
After you publish the service via ags you can then add that tool back into your toolbox in arcmap.
At that point you will have two versions of the same tool (one is disk based and the other is ags based).
When you run the ags-based gp version you will see the same types of error messages in your Results pane in ArcMap.
That can be helpful for debugging.
Also, when published you should still be getting error/message information from your tool. It may be harder to find now though. You can check the esri logs or you can try to run your gp service tool directly from the rest api page as you will get messages back there as well.

In cases where you aren't sure if your code is doing things you want it to do i typically litter my code with messages coming out - one after every line if you have to. This way you will know where it breaks and why. Also, check that if the tools/methods you are calling have return params and you can pipe those out as messages as well.

Are any of the tools you are using possible license-restricted on ags?
0 Kudos
ChanningDale
New Contributor III
Thanks for your reply, Kevin.  I'll have to try to put the tool in my other toolbox.

The Execute Reviewer Batch Job tool needs a Data Reviewer license.  I don't think that's the issue though.  When I run my tool as a GP service, ArcGIS Server says that it ran successfully, but I didn't get any results back.
0 Kudos
ChanningDale
New Contributor III
I thought I'd give a short update on this issue.  The reason why I wasn't getting any results back in my SDE database was because I had some hard-coded paths to databases and features classes in my script, and when I published my toolbox to ArcGIS Server, those objects were getting copied locally on the server, which I was unaware of.  I didn't want this to happen because I needed the results to be written to an SDE database so that I could query to see if results were actually returned by the tool.  All I had to do was remove those hard-coded paths, make them parameters and set them as constants, and make sure that I had all my data sources registered on the server's data store.  The tool has been running the way it was designed.

Also, my code was getting changed in my toolbox when I published it to the server, so I had to go to the copy on the server and change some of the code back to the way it was before publication.
0 Kudos
KevinGooss
Occasional Contributor
thanks for the update. glad you got it working.
seems to me that the copying of data and changing of scripts are hassles that arise at 10.1 because of the need to make these tools palatable for simple end users. and also the assumption that everyone is working in a cloud environment.
its regrettable and unfortunate. i think it ties the hands of developers for purported ease of use.
0 Kudos