question

Upvotes
Accepted
24 5 3 8

Cancelling executing job

Hi,

I see there is a lot of jobs running in DataScope Select. Many of them have been started from C# API as RawExtraction. How can I cancel them ?

Thanks

dss-rest-apitick-history-rest-apipending-job
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

@webmastertux1, do you know who / what created these jobs ? If they come from your tests, then all is fine, but if you don't know, it might be worth investigating.

Upvotes
Accepted
11.3k 25 9 14

Hi @webmastertux1

You can cancel active jobs using REST API or .Net SDK.

For REST API, the job cancellation can be request by issuing a delete to the monitor URL.

DELETE https://hosted.datascopeapi.thomsonreuters.com/restapi/v1/Extractions/ExtractRawResult(ExtractionId='<job Id>') 

Active Jobs can be requested by issuing the following request.

GET https://hosted.datascopeapi.reuters.com/RestApi/v1/Jobs/JobGetActive

For .Net SDK, the same functions are available. Below is the sample code which cancels all active Jobs.

jobsContext = new JobsContext(dssUri, dssUserName, dssUserPassword);
var activeJobs = jobsContext.JobOperations.GetActive();
//Output the active jobs
foreach (var activeJob in activeJobs.Take(10))
{
    System.Console.WriteLine("job: id {0}, status {1}, progress {2}, monitor url {3}",
        activeJob.JobId, activeJob.Status, activeJob.ProgressPercentage, activeJob.MonitorUrl);
    jobsContext.CancelJob(activeJob.MonitorUrl);
}

For more information about Jobs, please see this key mechanism.

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Upvote
4.4k 10 6 9

@webmastertux1

You can cancel an active in-progress job by submitting a DELETE to the MonitorUrl.
Or, in the case of .NET C# API, use:

ExtractionsContext.CancelJob(IAsyncJob asyncJob);

or

ExtractionsContext.CancelJob(string monitorUrl);

See the C# example application for more information on monitoring and canceling jobs.

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Upvotes
24 5 3 8

Thanks a lot. Exactly what I need

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.