Error Submitting Job: geoprocessing task wont complete

2927
3
04-14-2011 05:25 AM
RichardKaufholz
New Contributor
Hi there,

I have setup a geoprocessing task (a python script) that generates a PDF based on a map document "template". The script takes a number of arguments, including map extent, SR, visible layers, etc. (the script is actually the "Export PDF web application and GP service sample" from David Spriggs).

When I run this from ArcCatalog (as a tool) and enter some values, the tool runs and the PDF is created at my specified location on the local disk. However, when I access and run this very same task from my JSPAI application, it simply returns the error: "Error Submitting Job" (the error stack just points to the JSAPI - using v2.2).

I have setup a proxy and this seems to work fine (I get a 200 status) when submitting the task. The parameters are definitely correct, as I have written them to the console, then copied and pasted them in the tool dialog (via ArcCatalog) and the tool runs fine.

To test further, I used the SubmitJob page through the rest service directory. Again, I entered all the values and the results come back saying the task is complete. However, the PDF created is not located in the directory specified in the python script, but at some non-existent location (http://<server>/arcgisjobs/exportpdf_gpserver/j07d98f158f774503be941bcccedce974/scratch/Map_test6.pdf).

So, is it that the GP task ignores the file paths of the original script and uses a setting of its own to save the new file? If so, where is that setting? Or is that just a temp path used by the rest service interface? Or am I totally confused?

Any help or suggestions welcome.

Thanks,
Richard.

P.S. It also might be worth noting that the GP error I get comes back very fast. When the tool runs successfully from arccatalog it can take up to a minute. So I am assuming the problem is "early" in the task (i.e. connection, variables, etc.) rather than in the task itself.
0 Kudos
3 Replies
HemingZhu
Occasional Contributor III
Hi there,

I have setup a geoprocessing task (a python script) that generates a PDF based on a map document "template". The script takes a number of arguments, including map extent, SR, visible layers, etc. (the script is actually the "Export PDF web application and GP service sample" from David Spriggs).

When I run this from ArcCatalog (as a tool) and enter some values, the tool runs and the PDF is created at my specified location on the local disk. However, when I access and run this very same task from my JSPAI application, it simply returns the error: "Error Submitting Job" (the error stack just points to the JSAPI - using v2.2).

I have setup a proxy and this seems to work fine (I get a 200 status) when submitting the task. The parameters are definitely correct, as I have written them to the console, then copied and pasted them in the tool dialog (via ArcCatalog) and the tool runs fine.

To test further, I used the SubmitJob page through the rest service directory. Again, I entered all the values and the results come back saying the task is complete. However, the PDF created is not located in the directory specified in the python script, but at some non-existent location (http://<server>/arcgisjobs/exportpdf_gpserver/j07d98f158f774503be941bcccedce974/scratch/Map_test6.pdf).

So, is it that the GP task ignores the file paths of the original script and uses a setting of its own to save the new file? If so, where is that setting? Or is that just a temp path used by the rest service interface? Or am I totally confused?

Any help or suggestions welcome.

Thanks,
Richard.

P.S. It also might be worth noting that the GP error I get comes back very fast. When the tool runs successfully from arccatalog it can take up to a minute. So I am assuming the problem is "early" in the task (i.e. connection, variables, etc.) rather than in the task itself.


Any GP outputs run through ArcGIS server will be put in ArcGIS server's Jobs Directory whether you specify or not in your python script. It take the following format: http://<server>/Jobs directory/subFolder (your GP is located) if any/GP service name /JobID/your output. So the location you mentioned http://<server>/arcgisjobs/exportpdf_gpserver/j07d98f158f774503be941bcccedce974/scratch/Map_test6.pdf. actually did exist. And that is a good thing. It means that your gp actually worked. You can get your PDF by using GP getResultData(jobId, parameterName, callback?, errback?)
method. Mostly likely your failure is due to you do not set your parameters correctly in your code.
0 Kudos
RichardKaufholz
New Contributor
Hi..

Thanks for the info about the geoprocessor. Indeed, I can now see (and retrieve) the generated PDF when using the geoprocessing task through the services interface.

To test parameter input, I have written the exact values to the console (see code below), then copied and pasted them into the services interface - this is where I get a "esriJobSucceeded" status back.

var params = {
            "xMin": map.extent.xmin,
            "yMin": map.extent.ymin,
            "xMax": map.extent.xmax,
            "yMax": map.extent.ymax,
            "Spatial_Reference": map.spatialReference.wkid,
            "Map_Scale": esri.geometry.getScale(map),
            "Visiblelayers": dojo.toJson(visiblelayers),
            "Layout": dijit.byId("mapLayout").value,
            "Include_Attributes": dijit.byId("incAttribs").checked,
            "Map_Title": dijit.byId("mapTitle").value,
            "PointGraphics": getFeatureSet("point"), // optional
            "LineGraphics": getFeatureSet("polyline"), // optional
            "PolyGraphics": getFeatureSet("polygon") // optional
        };
  
  console.log("PDF PARAMETERS");
  console.log(map.extent.xmin);
  console.log(map.extent.ymin);
  console.log(map.extent.xmax);
  console.log(map.extent.ymax);
  console.log(map.spatialReference.wkid);
  console.log(esri.geometry.getScale(map));
  console.log(dojo.toJson(visiblelayers));
  console.log(dijit.byId("mapLayout").value);
  console.log(dijit.byId("incAttribs").checked);
  console.log(dijit.byId("mapTitle").value);
  console.log(getFeatureSet("point"));
  console.log(getFeatureSet("polyline"));
  console.log(getFeatureSet("polygon"));


I do use the getResultData function, but before that even fires, I check the status using the statusCallback as follows:

function pdfStatusCallback(jobInfo) {
  console.log(jobInfo.jobStatus);
  if (jobInfo.jobStatus === "esriJobFailed") {
            pdfErrorCallback();
        }
 }


That console statement is never fired. So basically, the task is not even being sent to the service as expected (which would hint at a parameter issue like you say), but I cant see how since I am successfully using the same parameters using the services interface..

Still stumped!

Richard.
0 Kudos
HemingZhu
Occasional Contributor III
Hi..

Thanks for the info about the geoprocessor. Indeed, I can now see (and retrieve) the generated PDF when using the geoprocessing task through the services interface.

To test parameter input, I have written the exact values to the console (see code below), then copied and pasted them into the services interface - this is where I get a "esriJobSucceeded" status back.

var params = {
            "xMin": map.extent.xmin,
            "yMin": map.extent.ymin,
            "xMax": map.extent.xmax,
            "yMax": map.extent.ymax,
            "Spatial_Reference": map.spatialReference.wkid,
            "Map_Scale": esri.geometry.getScale(map),
            "Visiblelayers": dojo.toJson(visiblelayers),
            "Layout": dijit.byId("mapLayout").value,
            "Include_Attributes": dijit.byId("incAttribs").checked,
            "Map_Title": dijit.byId("mapTitle").value,
            "PointGraphics": getFeatureSet("point"), // optional
            "LineGraphics": getFeatureSet("polyline"), // optional
            "PolyGraphics": getFeatureSet("polygon") // optional
        };
  
  console.log("PDF PARAMETERS");
  console.log(map.extent.xmin);
  console.log(map.extent.ymin);
  console.log(map.extent.xmax);
  console.log(map.extent.ymax);
  console.log(map.spatialReference.wkid);
  console.log(esri.geometry.getScale(map));
  console.log(dojo.toJson(visiblelayers));
  console.log(dijit.byId("mapLayout").value);
  console.log(dijit.byId("incAttribs").checked);
  console.log(dijit.byId("mapTitle").value);
  console.log(getFeatureSet("point"));
  console.log(getFeatureSet("polyline"));
  console.log(getFeatureSet("polygon"));


I do use the getResultData function, but before that even fires, I check the status using the statusCallback as follows:

function pdfStatusCallback(jobInfo) {
  console.log(jobInfo.jobStatus);
  if (jobInfo.jobStatus === "esriJobFailed") {
            pdfErrorCallback();
        }
 }


That console statement is never fired. So basically, the task is not even being sent to the service as expected (which would hint at a parameter issue like you say), but I cant see how since I am successfully using the same parameters using the services interface..

Still stumped!

Richard.


Look at your GP service through Service directory. It should list all the parameters. Use it as a guide to define your parameters. I have a code sample listed at this thread: http://forums.arcgis.com/threads/27763-Problem-with-Geoprocessing-Service.
0 Kudos