Vault Customization

Reply
Mentor
FarrenYoung
Posts: 263
Registered: ‎07-13-2009
Message 1 of 4 (186 Views)
Accepted Solution

UpdateJobFailure - Error 160

186 Views, 3 Replies
09-06-2012 03:30 PM

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?

--Farren

************************************************************************************
If this post helps, please click the "thumbs up" to give kudos
If this post answers your question, please click "Accept as Solution"
************************************************************************************
Employee
Redmond.D
Posts: 796
Registered: ‎12-12-2006
Message 2 of 4 (171 Views)

Re: UpdateJobFailure - Error 160

09-10-2012 11:13 AM in reply to: FarrenYoung

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.



Doug Redmond
Software Engineer
Autodesk, Inc.
http://justonesandzeros.typepad.com/

Mentor
FarrenYoung
Posts: 263
Registered: ‎07-13-2009
Message 3 of 4 (168 Views)

Re: UpdateJobFailure - Error 160

09-10-2012 12:50 PM in reply to: Redmond.D

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.

 

 

--Farren

************************************************************************************
If this post helps, please click the "thumbs up" to give kudos
If this post answers your question, please click "Accept as Solution"
************************************************************************************
Mentor
FarrenYoung
Posts: 263
Registered: ‎07-13-2009
Message 4 of 4 (165 Views)

Re: UpdateJobFailure - Error 160

09-10-2012 12:53 PM in reply to: Redmond.D

I missed the bit about unreserving to set it back to ready.  I will use that instead of re-submitting.

 

Thanks again.

--Farren

************************************************************************************
If this post helps, please click the "thumbs up" to give kudos
If this post answers your question, please click "Accept as Solution"
************************************************************************************

You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.

Need installation help?

Start with some of our most frequented solutions to get help installing your software.

Ask the Community