How to tell when GeoprocessingJob has been canceled?

646
3
Jump to solution
06-15-2020 01:03 PM
KirkKuykendall2
Occasional Contributor

I don't see a JobCanceled in the JobStatus enumeration.

When I call Cancel on a GpJob, the next status update status says failed.

Is there some way to verify that it's been canceled - and not failed?

BTW, the REST API Jobstatus has "esriJobCanceled" along with some others that aren't in the .NET SDK...

  • esriJobSubmitted (missing)
  • esriJobWaiting (paused?)
  • esriJobExecuting (started?)
  • esriJobSucceeded
  • esriJobFailed 
  • esriJobTimedOut (missing)
  • esriJobCancelling (missing)
  • esriJobCancelled (missing)
Tags (2)
0 Kudos
1 Solution

Accepted Solutions
MichaelBranscomb
Esri Frequent Contributor

Kirk,

The `Job` in this case represents a Runtime Job which handles specific runs of the Task instance. It's a common framework for Runtime Tasks. For Geoprocessing the Job can be either:

- Synchronous "execute"

- Asynchronous "submit job"

Only the server-side "submit job" type provides a job ID and the status list you shared above. Those status values will be available in the Messages property of the GeoprocessingJob class.

Thanks

Mike

View solution in original post

3 Replies
MichaelBranscomb
Esri Frequent Contributor

Kirk,

The `Job` in this case represents a Runtime Job which handles specific runs of the Task instance. It's a common framework for Runtime Tasks. For Geoprocessing the Job can be either:

- Synchronous "execute"

- Asynchronous "submit job"

Only the server-side "submit job" type provides a job ID and the status list you shared above. Those status values will be available in the Messages property of the GeoprocessingJob class.

Thanks

Mike

KirkKuykendall2
Occasional Contributor

Hi Michael -

This seems to work with the LocalServer geoprocessing sample.  Glad to see ArcGIS Enterprise returns the same "Job canceled" too.

Thanks!

0 Kudos
EricBader2
New Contributor III

Hey Mike,

If I cancel a sync process, does this Cancel actually 'roll back' anything that took place during the job process before the cancel? I was assuming it does.

Thanks!

0 Kudos