Email notification after kill of scheduled job in Orchestrator due to stop after time

We have a scheduled unattended bot process in Orchestrator (version 2018.4.3). It normally runs for 1 minute or less daily, but we put a stop job after time of 5 minutes with the kill selected so the job doesn’t hold up subsequent processes that are scheduled.

image

We have had a couple of instances where the job doesn’t fail with an exception, but just seems to hang eventually hitting this time limit. The unattended bot continues to process subsequent jobs just fine, but we would like to be notified that this time limit occurred, preferably with an email. Does anyone have a good solution for this? I have seen the “Should Stop” activity, but the process is not doing anything so this activity would not be executed

Fine
welcome back to uipath community
you want to know the time once the process gets completed or the time if the process gets killed because of this action set in the process

–so for both of this we can use Should stop activity as you mentioned but the option stop should be selected under actions instead of kill
–the reason is its always a good practice to add should stop inside of kill job because we can try to complete the transaction or process upto required stage so that it wont affect the instances while we try to access the same instance for the next
–though we dont have much process here to be executed taking less than a minute
its good to have should stop along the process, but how thats the question…?
Great
–now use a should stop activity in the place along the process where it wont affect the instance we are working,
–before to this should stop activity use a assign activity like this
time_taken = Now.ToString(“hh:mm:ss tt”)
where time_taken is a string variable
–we can use send outlook or send exchange mail activity and mention the TO and SUBJECT property with appropriate value and pass the time_taken string variable to the body of the activity and mention the string like this
"The time taken while completing process is : "+time_taken.ToString

this will send the mail to the recipient we mention
so the sequence should be like
–mention all the activities we have
–decide where to place the should stop activity
–prior to this should stop activity use these two activities like assign with time_taken value and send outlook or send exchange mail activity

Hope this would help you
Cheers @jlock

Thanks for the feedback, but I don’t think that covers what I was looking for:

I just want to know that the job did not finish. Right now it just ends up stopping the job, but there is no notification unless I look in the Orchestrator Jobs section to see that it was stopped.

I don’t think I can use the Should Stop activity because the job is not continuing to process anything. Here is the scenario:
5:00am - Process A kicks off. It processes for 10 seconds (I see all the Trace logs for 10 seconds) but then gets hung up causing no more log messages after 5:00:10am.
5:05am - The Stop Job After (with Kill selected) stops the process. In the Orchestrator jobs section the process shows a state of “Stopped”.
5:10am - Process B kicks off and runs successfully.

I didn’t know that Process A didn’t complete until I went and looked in Orchestrator. I would just like to be notified that Process A did not complete/stopped - preferably email. Is there a way to do that?

1 Like

@jlock - In settings, there is an option to enable alerts email. Any alert can then be sent via email to accounts that have those alerts turned on.

@sagacity - This was extremely helpful. Thank you.

I am now getting notification alerts of jobs that faulted. One other question… Is there a way to get the jobs that are stopped (Stopped State)? These are the ones I would really like to see in my Error Summary report since that is the State they are in when the Stop Job After time is expired.

@jlock @Palaniyappan @loginerror @Pablito

I face similar issue - I would like to get notified once a job is being stopped due to trigger setting. This seems like something that is not available out of the box. Is there any workaround this and get notified once the job is stopped?

Hi @pawel.czyz,
It’s just only my idea but using for example REFramework or other template where you are catching exception you could add additional activity Raise Alert which will automatically trigger alert in Orchestrator and with proper settings in Orchestrator it will send you an email.

More information:

Hi @Pablito, thank you for your reply. Actually, what I’ve meant to ask was about killing a job. Is there any way to do something after killing a job? I have a process that should be completed in no more than 5 minutes so I set trigger to kill the job after 5 minutes. I would like this to result in a faulted job status to get email notification. Currently killed jobs are displayed as ‘stopped’ and there is no alert for stopped jobs. Can an alert be setup for killed jobs or is there any way to do something every time a process is killed?

It is a nice feature request → I moved it to our User Voice category :slight_smile:

Edit. In the meantime, I have dug deeper into the behaviour of the Kill action in Orchestrator.

How it works:
• Whenever a process is sent the Kill command from Orchestrator, it first tries to Cancel the execution and if the execution is not finished in 3 seconds, the execution is killed.
• Whenever a process receives the Cancel command, it cancels the execution of the current activity and starts executing the Finally block for clean-up reasons.

This means that you have a three second grace period to send out an email in the Finally of the Try-Catch that surrounds your process.

It is a bit ‘hacky’, but could do the trick for you for now.

Edit2.
Well, on a second thought, this assumes that your workflow is not stuck for that 3 seconds, which seems to be your case.
I’ll decided to keep it here though for future reference.