Start Job On Machine Template

I have a process in a folder and multiple machine template but what i want is that this job is started on particular machine template only.How do i specify the machine template in the startJob Api
“odata/Jobs/UiPath.Server.Configuration.OData.StartJobs”. Here the issue i am facing is there are alot of fields in the payload of this api and i don’t quite understand what payload is best suited for me

Hi @Varun_Sharma1

Below payload should be enough for you to start a job:

{
“startInfo”: {
“ReleaseKey”: “your release key”,
“Strategy”: “Specific”,
“RobotIds”: [your robot id],
“MachineSessionIds”: [your machine session id where you want the job to start],
“Source”:“Manual”
}
}

Regards
Sonali

I have the ID for the machine template and the ids of the 3 robots within it so do i need to put the machine templates id in MachineSessionIds and the robotIds in the RobotIds array?

@Varun_Sharma1

Yes, you will need to provide your robot id in robot array.

But for machine session id, you will first need to fetch the session id for the machine template you want to run your process on.

by using below endpoint:

/odata/Sessions/UiPath.Server.Configuration.OData.GetMachineSessions(key=your machine id)

Hi @sonaliaggarwal47 this is working but still i don’t have much clarity about what the machine sessionIds and robots actually mean like how are they different from each other. If you can share some resource for the same?

@Varun_Sharma1

I am glad to know it worked:) Kindly consider marking solution to close the topic and help others.

For more info on robot ids and machine session ids, you can refer swagger documentation shared below, also sharing a snapshot from swagger below for your quick reference:

Hope this helps.

Regards
Sonali

I am getting this error when i am specifying the robots i found for my machineTemplate and all the sessionIds in the machineSessionIds array
“message”: “You cannot specify more than one specific machine to run the job”,

@Varun_Sharma1

You only need to provide session id for the machine(not all machines) you want your process to start on

Also please note if you are giving strategy as specific, robot id and machine session id needs to be specific- only 1.

{
“startInfo”: {
“ReleaseKey”: “”,
“Strategy”: "ModernJobsCount ",
“JobsCount”: 1,
“MachineId”: Id
}
}

This is what i am using and i think this will serve the purpose because my aim is to run the process on any machine within the machineTemplate whose machinId i have mentioned. So it by defaults searches for the unattended robot which has access to the machine template so i think this will serve the purpose.

1 Like

Yes there are multiple ways to start a job but depends what and how your preference is.

The one I shared was specific for a particular machine/robot.

You can use that one also for multiple machines/robots but for that strategy parameter in there should be “All” not “specific”

I want to start my job on a particular machine template.I dont want to specify robotId since if i specify the robotId then it will always allocate job to that robot even if it is busy.So normally if i dont specify anything like machineId also it fetches the available machine and robot, but my usecase is that i dont want to execute job on any other machineTemplate even though current is busy but robot should be chosen according to its availability.So tell me what strategy of startJob api in swagger should i use. I have used specific it asks for robotIds which becomes useless and also it ignores the machineId.Apart from this if i use “specific” strategy then in documentation robotIds is array but whenever i try to pass more than 1 robot or machine it fails. The documentation is completely misleading and useless so please someone help

@Varun_Sharma1 try this

{
“startInfo”: {
“ReleaseKey”: “YOUR_RELEASE_KEY”,
“Strategy”: “Specific”,
“MachineRobots”: [
{
“MachineTemplateId”: “YOUR_MACHINE_TEMPLATE_ID”,
“RobotId”: “YOUR_ROBOT_ID”
}
],
“JobsCount”: 1,
“Source”: “Manual”,
“RuntimeType”: “Unattended”
}
}

Hi @Varun_Sharma1

In that case, mention the strategy as “All” and keave robotids as empty collection.

Follow below doc for more details on this

https://uipath.my.salesforce-sites.com/CaseView/articles/Knowledge/start-a-job-using-Orchestrator-API

Hope this helps.

Regards
Sonali

Hi @sonaliaggarwal47 this won’t help since using Strategy=All will run on all robots available in that environment but my usecase is to run on only one robot and a particular machine template and the usecase i want is that it just finds the available robot on its own so that minimum number of jobs are allocated to already busy robots and going to pending state.

Here the issue is i am specifying the robotId but i don’t want this dependency suppose there are 3 robots in environment and if i allocate all jobs to same robot then for rest jobs they will go in pending state since this robot is already occupied so i want that in that case it automatically looks for some other available robot in the same folder and executes the job on that folder.

@Varun_Sharma1

Oh okay.

Could you please use strategy as “ModernJobsCount” and leave robotIds empty in square brackets..?

It should work

Hi @sonaliaggarwal47 this approach works but the only thing here is that at a time i can mention only 1 machineSessionId so for that i think i will make an api call to fetch the machineSessions for the template which have status=Available and then i will allocate the job to it.The robot part is sorted it shifts the robot on its own so yes it works.

1 Like

try this @Varun_Sharma1

Do NOT specify robotId in your job start request or trigger.

Instead, use:

  • "strategy": "ModernJobsCount"
  • "jobsCount": 1

This tells Orchestrator to pick any available robot in the folder automatically.

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