Suspend pending jobs of an Unattended Robot

Hi,

Is there a way in Orchestrator (or API) to hold or suspend all the pending jobs of a particular unattended robot ? My case is that I want to suspend all the pending jobs of a particular host machine which is running as an Unattended Robot, so that I can then work on some other things on that machine. And after I finish, I can resume those suspended pending jobs.

Thanks

Hello @Snowman ,

You can make a try using Swagger.
https://docs.uipath.com/orchestrator/reference/api-references

Thanks,
Sanjit

Thanks for your reply. I know there is license requests api to enable/disable the license, but seems there is no api for suspending the pending jobs. Can you point me to the api so that I can make a test on it ?

Thanks

From what I understand you need these:

Stop Jobs

Method: POST
URL: https://ORCHESTRATOR_HOSTNAME/odata/Jobs/UiPath.Server.Configuration.OData.StopJobs
Headers:

X-UIPATH-OrganizationUnitId: FOLDER_ID
Content-Type: application/json
Accept: application/json

Authorization: Bearer access_token

Body of type JSON:

{"jobIds":[JOB_ID1,JOB_ID2,...],"strategy":"1"}

Kill Jobs

Method: POST
URL: https://ORCHESTRATOR_HOSTNAME/odata/Jobs/UiPath.Server.Configuration.OData.StopJobs
Headers:

X-UIPATH-OrganizationUnitId: FOLDER_ID
Content-Type: application/json
Accept: application/json

Authorization: Bearer access_token

Body of type JSON:

{"jobIds":[JOB_ID1,JOB_ID2,...],"strategy":"2"}

To find the JobId (it will be the Id in the response), run a GET request (also you may apply some extra filters) for

https://ORCHESTRATOR_HOSTNAME/odata/Jobs?$filter=((ProcessType eq 'Process' and State eq 'Pending' and Machine/Name eq 'MACHINE_TEMPLATE_NAME'))&$top=1000&$expand=Robot,Machine,Release&$orderby=CreationTime desc

Reference: Building API Requests

Let us know if this helped.

Hi Marian,

Thanks for your instruction, the 2 API seems to resemble the Stop and Kill functions in Orchestrator. Stop and Kill will terminate the job in a pre-mature way, but not wait until the job finish. What is preferred:

  • suspend all pending jobs
  • wait until the current executing job to finish (Stop if a built-in activity exist in the workflow, or Kill if over a certain period of time)
  • no pending jobs will be executed, and the robot machine is free for some other non RPA works
  • work on something else on the robot machine
  • resume all pending jobs when the robot machine is ready

In this case, no job is affected and we don’t need to worry if there is any jobs missed execution.

I think what you what to achieve is not achievable as you want.

Pending - A job is in this state if it is queued on the same Robot or it is trying to establish a connection with the Robot (only different jobs on the same Robot can be queued).

Either you wait until the pending job is running and wait for its finish status, or you Stop/Kill and then retry the job after the machine is ready.

1 Like

Appreciate your answer. Just wonder if there is way to disconnect the robot (from Orchestrator) so that it will not pick up any pending jobs, and is then free for some other tasks. From Orchestrator, I can delete the robot, but if it is running a job, it cannot be deleted (which is good); but then if it picks up another pending job right after the previous job is finished, I can never delete this robot.

From Orchestrator you cannot do that as you want.

But you can do it programmatically from the Robot machine to disconnect the Robot connection.

To disconnect robot directly from the robot machine, is there API for robot or VB scripts ?

"C:\Program Files\UiPath\Studio\UiRobot.exe" --disconnect

or

"C:\Program Files\UiPath\Studio\UiRobot.exe" disconnect

Reference: Arguments Description

1 Like

Many thanks.

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.