Solved

React against a cancellation of a workbench job?


Badge

I have a long running workbench on the FME server. Is it possible to take actions if a job submitted is canceled?

proposed workflow

1. submit a job

2. cancel a job

3. write into a file information regarding the job that was cancelled (is possible to do it inside the same workbech? is possible to do it with another workbench? a subscription could help??)

 

[EDIT]:The idea is that step 3 is automatically triggered after the cancellation of the job, that is what I mean by "React".

[EDIT]: I am using FME Server 2018.1.2 - Build 18590 - win64: I notice that JOBSUBMITTER_ASYNC_JOB_FAILURE topic is not triggered when a job is canceled.

thanks for any hint provided.

 

icon

Best answer by mark2atsafe 30 October 2019, 16:59

View original

14 replies

Badge +16

Hi @xtian79,

You can use the FME Server REST API to query the status of the jobs:

GET /transformations/jobs/id/< jobid >/result

For if you have the job ID or:

GET /transformations/jobs/completed

For all jobs.

Badge

Hi @xtian79,

You can use the FME Server REST API to query the status of the jobs:

GET /transformations/jobs/id/< jobid >/result

For if you have the job ID or:

GET /transformations/jobs/completed

For all jobs.

Thanks for your answer, but it is not suitable for me, because i required an automated/programmed solution, that not involves a permanent pooling for the status of one job. i will complete my question.

Badge +16

Thanks for your answer, but it is not suitable for me, because i required an automated/programmed solution, that not involves a permanent pooling for the status of one job. i will complete my question.

No need to pool foe the status if you make it part of the workflow.

Somehow you will need to get the job status to define if it is cancelled.

Badge

No need to pool foe the status if you make it part of the workflow.

Somehow you will need to get the job status to define if it is cancelled.

As far as I understand you, I can verify the status of a job from the same running workbench? is that correct?

Badge +16

As far as I understand you, I can verify the status of a job from the same running workbench? is that correct?

For that you will probably need a master / slave construction, using the FMEServerJobSubmitter calling the slave workspace in the master workspace. The result of the transfomer can be used to query the job status.

Badge +16

As far as I understand you, I can verify the status of a job from the same running workbench? is that correct?

Another option would be to use a default topic to notify after job completionand have a secondary proces querying for the job status. This is a more generic approach.

Badge +5

I think this would be a good enhancement to the FME Server System Event notifications capabilities. It might be worth submitting a request for this enhancement...

Badge +5

I think this would be a good enhancement to the FME Server System Event notifications capabilities. It might be worth submitting a request for this enhancement...

Actually, thinking a bit more about it, this is already possible.

There are default topics which get published to whenever a workspace fails on FME Server (a cancellation is considered a fail). You just need to set up an Automation (FME Server 2019+) or Subscription (FME Server <2019) to listen for the failed workspace topic notification and then process accordingly.

Badge

Actually, thinking a bit more about it, this is already possible.

There are default topics which get published to whenever a workspace fails on FME Server (a cancellation is considered a fail). You just need to set up an Automation (FME Server 2019+) or Subscription (FME Server <2019) to listen for the failed workspace topic notification and then process accordingly.

Sounds good, I am going to try

Badge

Actually, thinking a bit more about it, this is already possible.

There are default topics which get published to whenever a workspace fails on FME Server (a cancellation is considered a fail). You just need to set up an Automation (FME Server 2019+) or Subscription (FME Server <2019) to listen for the failed workspace topic notification and then process accordingly.

Hi @nic_ran, i was looking the info in the link that you posted, but that is information from 2013, I tried to look for the latest one, but there is no default topics mentioned in the current documentation.

So far, I try to create a subscription to the topic:

JOBSUBMITTER_ASYNC_JOB_FAILURE

acording to https://docs.safe.com/fme/html/FME_Server_Documentation/ReferenceManual/Monitoring_FME_Server_Activity_Using_Notifications.htm#Monitori2

Badge

Actually, thinking a bit more about it, this is already possible.

There are default topics which get published to whenever a workspace fails on FME Server (a cancellation is considered a fail). You just need to set up an Automation (FME Server 2019+) or Subscription (FME Server <2019) to listen for the failed workspace topic notification and then process accordingly.

I set up the subscription to the topic mentioned above, and it works perfectly when I test the topic. Funny part: the subscription does not works when i submit a job and it fails, neither when i cancel it. (I am using the FME 2018 and the workspaces in the samples folder)

Badge +5

I set up the subscription to the topic mentioned above, and it works perfectly when I test the topic. Funny part: the subscription does not works when i submit a job and it fails, neither when i cancel it. (I am using the FME 2018 and the workspaces in the samples folder)

Sorry for the old link. Here's the link from 2016 about default topics (and it's still current in 2019):

https://knowledge.safe.com/articles/30539/workspace-notifications-part-2-configuring-the-def-4.html

You'll note that there are different topics which get notified depending on the service you've configured your job to run under, so make sure to use the correct one (either JobSubmitter or DataDownload). If you're not using those services then you can always create your own topic/notification/subscription. This would give you more fine-tuned control as you could do it for a specific workspace.

Badge

I think this would be a good enhancement to the FME Server System Event notifications capabilities. It might be worth submitting a request for this enhancement...

After an implementation of a long running workspace, and be able to cancel it (I am not so fast),

I notice that JOBSUBMITTER_ASYNC_JOB_FAILURE topic is not triggered.

 

 

As seen in the image , the workspace was cancelled one and failed 3 times, and the topic monitoring show me the 3 failures activation but not the one from the one from the cancel action.

What i am missing here? is this really not supported by FME Server?

Userlevel 4
Badge +25

I believe this has been implemented in FME2019. See this idea for more info:

https://knowledge.safe.com/idea/76535/topic-on-cancel-1.html

In short, you can use either automations or a traditional topic; but either of those should fire when a job is cancelled, whether it's an automatic or manual cancellation.

I hope this helps. I would have brought this to your attention earlier, but to be honest I didn't realize that idea had been implemented, so apologies for that.

Pre-FME2019 I think the only realistic way is that suggested by @itay - you would need to have a separate workspace (maybe one that runs on a schedule every minute or two) that checks the completed jobs queue for cancelled jobs. Not ideal, which is why I think we implemented this in 2019.

Reply