How to check if a GP service (async) has any jobs that are not completed yet?

1230
2
Jump to solution
08-16-2013 11:43 AM
AlexeyTereshenkov
Regular Contributor III
Hi folks,

I am trying to find out a way to tell if a GP service has any jobs that were submitted and are not completed yet. I have noticed that one can see the status of a specific service by using the ArcGIS Server Services Directory (by using a jobid value). However, I am not interested in a specific job; my concern is only to see if there are any jobs currently started by a GP service. I need to know if a service is busy working on any job because I need to make sure that there aren't any other jobs started when running a new one. This is because the GP service writes some data which results in some locks which I want to avoid.

The current way I do that is by using Python to access the statistics page of the service:
http://server:6080/arcgis/admin/services/GPServiceName.GPServer/statistics
I am using Python for server administration using the ArcGIS REST API. I have written a piece of code that uses  this page to check if there are any busy instances (which means a service is busy working on a job). If this key's value is 0 then it means the service is not working on any job and it is safe to run another one.

I consider this to be more of a workaround and looking to figure out if this information (if a GP service has any jobs running) is exposed via REST API. It seems as it doesn't, but wanted to ask others to make sure I haven't missed anything.

Thank you.
Tags (2)
0 Kudos
1 Solution

Accepted Solutions
KevinHibma
Esri Regular Contributor
Alex,

Thats the way I'd check.
Without having knowledge of the JobID, you can't check the status for a particular job. The only person with the JobID is the person who probably submitted it.
Sure, you as the Server administrator have the IDs, but you'd have to parse through all of them and find any that arent "finished or failed".
If you just want to know if an instance is in use, simply using the statistics like you are and checking if not 0 is probably the best way.

View solution in original post

0 Kudos
2 Replies
KevinHibma
Esri Regular Contributor
Alex,

Thats the way I'd check.
Without having knowledge of the JobID, you can't check the status for a particular job. The only person with the JobID is the person who probably submitted it.
Sure, you as the Server administrator have the IDs, but you'd have to parse through all of them and find any that arent "finished or failed".
If you just want to know if an instance is in use, simply using the statistics like you are and checking if not 0 is probably the best way.
0 Kudos
AlexeyTereshenkov
Regular Contributor III
Kevin, thank you so much for letting me know. I have thought of looping through all the jobs (in the arcgisjobs directory) or by collecting the jobid when starting the job, but thanks anyway. I will keep using the statistics page and see if there will be any support for this type of GP task status request in upcoming versions.

Cheers,
Alex
0 Kudos