Orchestrator API StartJob with Kill

I’m trying to make an API call to the Orchestrator API using StopStrategy as Kill. How do I set the maximun running time, for the Kill action to take place, as I would set in a trigger?

I have a process starting via API call but it got stuck this weekend, and the Robot was unable to run other jobs for a long period of time.

If your process is running longer than it should, your automation isn’t written well. Fix the automation so it stops gracefully after a certain amount of time, or a certain number of items processed.

Anyway, if you issue a Stop command through Orchestrator it doesn’t do anything unless you’ve coded your process to look for it and stop.

1 Like

Hey Paul, thanks a lot for you answer.
We don’t use Should Stop yet, although we are aware of it and planning to study it for future bots.

In this specific case, however, I got the following error:
RemoteException wrapping System.Exception: Job stopped with an unexpected exit code: 0x40010004

The error was logged about 15 minutes after the job started, but the job was “Stopping” for more than 24 hours and only then it stopped. As all of this happened during the weekend, we only became aware of it this morning.

This error seem to have something to do with the VM. Our IT team is taking a look at it.
Anyway, I don’t know how to bypass this kind of thing on the bot code. I would appreciate any tip regarding that.

That’s why I asked if there was a way to send a Kill command (not a Stop one) when making an API call to Orchestrator. A Kill command with 20 minutes limit would be perfect for this particular case.

Kill will stop the job instantly, with no regard for where it is in the process.

That’s the point to Should Stop. You write into your code for it to look for a stop command, and write in your code how/when it stops when it detects a stop command.

Hi Paul,

I thought it was something along these lines, thanks for clarifying that!
Still, I don’t think it helps me with the situtation I describe above.

Any suggestion is welcomed!


The suggestion is to write the automation so it stops when it should, after a certain amount of time or items processed.

It’s a very simples job, it processes one item only.
And, as I said, it was a error code that indicates the Orchestrator had problems communicating with the VM, which left the job “Stopping” for more than 24h.
I don’t see how I could have predicted or treated that occurence inside the bot code to avoid this behaviour. That’s what I am looking for, a way to avoid my environment to be stuck for most of the weekend when such a unusual error pops up.

Oh I didn’t realize it’s just a “process one and stop” automation.

It’s weird that I don’t see anything in Swagger for the StartJobs API to set the execution time like you can in Orchestrator. But looking at GetJobs I see this…


So I wonder if you can pass StopStrategy as Kill to StartJobs to prevent yours from hanging at stopping.

1 Like

Hi, did you give a try configuring it directly on the Orchestrator? You can Stop or Kill a process by configuring it on Orchestrator Triggers.


1 Like

I am going to give it a try. Thanks a lot!