I am trying to manually update a job status in vault 2012 professional. Is this possible? I tried the method UpdateJobFailure, but get error 160.
My plan is to be able to change a job from Ready to Paused and then later change the Paused job back to Ready by resubmitting it. I have the code working to resubmit it, but how can I cancel a job that is in the Ready state without the job prcessor actually picking it up and erroring it out?
Solved! Go to Solution.
Solved by Redmond.D. Go to Solution.
I'm not exactly sure what you mean when you say that you want to "change a job from Ready to Paused"
Jobs don't have a "Paused" state. Looking at the JobStatus enum in the SDK documentation, the states are Failure, Ready, Running, Success.
If you want to move a job from Ready to Running, you call ReserveNextJob. If you want to move the job back to Ready, call UnReserveJobById. I you want to move a Ready job off the queue, you can either call DeleteJobById or you can reserve it and call UpdateJobSuccess.
It seems that you want to get these jobs before Job Processor gets them. The way that the job queue works is that a job gets reserved to the first client that requests a job of that type. So there is no way to guarantee that your app will always get the job first.
Maybe you could elaborate what problem you are trying to solve.
I was just trying to manually "Fail" a job.
I wrote my own job queue manager and one of the features I wanted was to "Pause" a job (prior to it ever running) so that the job processor would not pick it up. "Resuming" a paused job is done by Re-submitting it. It seems like I was just missing the ReserveNextJob bit as it's working after adding that.
JobSvc.ReserveNextJob(New String() {job.Typ}, System.Environment.UserName)
JobSvc.UpdateJobFailure(job.Id, "User canceled job")
You might consider mentioning in the api help that a job needs to be reserved prior to updating the job failure.
Thanks for your help.
I missed the bit about unreserving to set it back to ready. I will use that instead of re-submitting.
Thanks again.
Can't find what you're looking for? Ask the community or share your knowledge.