Question

Find the status of a job using REST API

  • 3 January 2022
  • 6 replies
  • 222 views

Hi,

I have triggered one of the job suing REST API in StreamSets and I need to the status of the job if it is failed or successful. I am able to get the status of the job but if the job is failed or successful, I am getting status as Inactive in both success and failure case. I need to get exact status like success or failure and error message in case of job failure. Please let me know how I can I achieve this StreamSets. 


6 replies

Userlevel 5
Badge

@santhoshchalla Moved your question to the “Got a Question” category. 

@Drew Kreiger Is there any solution found for this problem

 

Thanks

Prasanna kumar

Userlevel 4
Badge

hi @prasanna_kumar 

you need to use the status and color both from the output.

So if the job has finished successfully, you will se GRAY color and if the job has failed with ERROR it will be INACTIVE with RED color.

 

The API i used is : https://eu01.hub.streamsets.com/jobrunner/rest/v1/job/{Job_id}/currentStatus

"color": "GRAY",
"sdcIds": [
"91f8d9a6-cb01-4e6a-93e0-37e373c51c37"
],
"status": "INACTIVE",

@saleempothiwala  Yes saleem working on it.Getting the occurence of jobstatus id is also important before that step so figured it out actually.

 

Thanks for your inputs

 

 

Userlevel 4
Badge

@prasanna_kumar let us know if the solution worked for you.

@saleempothiwala This one will work.

but I was little cautious if a job is triggered  simultaneously and there are multi runs before you fetch the current status might give misleading results if the job execution duration is of very short time.(The chance of this happening might be very slim but not avoidable)

 

I have tried

1.start the job

2.wait for the jobstatusid which is a unique identifier for particular job invocation to go inactive

3.Fetch the status of that from job history status.

This process was followed to avoid little to clear ambiquity if there is multiple execution before fetching the status of job.

Thanks

Prasanna Kumar

 

Reply