How to delete a job?

2583
5
07-27-2011 05:07 AM
EvgeniaKaradjova
New Contributor
Hi to all,
I'd like to ask is it possible to delete a job using some standart tool of Workflow manager like Model.instance.workflowManagerTask in my source code or I need to make a queryTask to related tables in my JTX database. And if the case is to make a queryTask so which tables should be affected? I think it won't be only the table "JTX_JOBS", will it?

Thanks!
0 Kudos
5 Replies
BrianDemers
Esri Contributor
Hi,

If you're coding in ArcObjects, then the C# version will look something like:
int jobId;

// Set your job ID to the ID of the job to be deleted

IJTXJobManager jobManager = m_ipDatabase.JobManager;
jobManager.DeleteJob(jobId, true);

There's also a "DeleteJob" GP tool included with the Workflow Manager Administration Utilities, if you'd like to do this from a Python script.

I hope that helps.

Brian D.
0 Kudos
EvgeniaKaradjova
New Contributor
Well, I am using flex and Workflow manager in its web version is my subject of action. So will Workflow Manager Administration Utilities be helpful about my purposes? Shall I download these utilities?

Thanks!
0 Kudos
BrianDemers
Esri Contributor
Ah, I see.  In that case, no, the administration utilities most likely won't help you.

There's definitely a REST interface for deleting jobs, though I don't have a code example at the ready.  I'm not sure if the Flex sample viewer includes an object/class for managing jobs.  However, even if it doesn't, I'd at least expect the behavior of "DeleteJobs" to be consistent with that of the other calls you're making to Workflow Manager Server.

...not sure if that helps...?
0 Kudos
ThomasHill
New Contributor
There is currently not a method in the Flex WorkflowManagerTask to delete a job.  However, you can call the REST API directly from your code:

var urlVars:URLVariables = new URLVariables();
urlVars.f = "json";
urlVars._ts = new Date().time;
urlVars.user = "yourWorkflowManagerUsername";

var urlRequest:URLRequest = new URLRequest(Model.instance.workflowManagerTask.url + "/jobs/" + jobId + "/delete");
var urlLoader:URLLoader = new URLLoader();
urlLoader.load(urlRequest);


We will provide a WorkflowManagerTask.deleteJob() method in a future release of the Workflow Manager Flex API.
0 Kudos
EvgeniaKaradjova
New Contributor
I'll try to use the REST API directly from source code.

Thank to both of you!
0 Kudos