run only one task in one node

1,294 views
Skip to first unread message

Parveen Kumar

unread,
Apr 5, 2016, 6:17:56 AM4/5/16
to Nomad
Hi All,

i need to run only 1 task in one client node.
i have 2 server and 4 client. i have defined two task in one group in nomad job where i defined count as 2 for both task.
my use case is when i run the job. there would be total 4 task and 4 allocation. but i want that each allocation should happen on one machine only.
if cl1 is assigned task 1 , it should not be allocated task 2 also.

can i do it? please confirm.

Diptanu Choudhury

unread,
Apr 5, 2016, 3:20:09 PM4/5/16
to Parveen Kumar, Nomad
Hi Parveen,

You can add a distinct_host constraint to restrict two allocations of a same job running on the same machine. Please refer to the constraint section in the documentation - https://www.nomadproject.io/docs/jobspec/index.html

--
This mailing list is governed under the HashiCorp Community Guidelines - https://www.hashicorp.com/community-guidelines.html. Behavior in violation of those guidelines may result in your removal from this mailing list.
 
GitHub Issues: https://github.com/hashicorp/nomad/issues
IRC: #nomad-tool on Freenode
---
You received this message because you are subscribed to the Google Groups "Nomad" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nomad-tool+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/nomad-tool/1910ca3d-ca54-43de-8d78-af7f565db87b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Thanks,
Diptanu Choudhury

Parveen Kumar

unread,
Apr 5, 2016, 11:26:08 PM4/5/16
to Nomad
Hi Diptanui,

Thanks for suggesting distinct_host. I have already tried distinct_host but it only restrict same job on one machine. Here, i want the single task from the same job to be allocated on one client machine.
Can we use any other constraint. also i didn't find constraint list supported by nomad. provide that so that i can do modify my job closer to match my scenario needs.

--
Thanks,
Parveen Kumar
http://in.linkedin.com/in/parveenkumar1990

Alex Dadgar

unread,
Apr 7, 2016, 4:51:34 PM4/7/16
to Parveen Kumar, Nomad
Hey Parveen,

You are slightly mixing up the terms (task, task group, job). So it is a bit hard to determine your desired goal. But distinct_host specified at the job level will ensure that all the task groups in the job will be on unique machines which sounds like what you want.

Thanks,
Alex

Parveen Kumar

unread,
Apr 7, 2016, 11:02:54 PM4/7/16
to Nomad
Thanks Alex. I think i am looking for something else. Can you provide me list of constraints which we can use in nomad jobs?

Alex Dadgar

unread,
Apr 11, 2016, 3:46:51 PM4/11/16
to Parveen Kumar, Nomad
The constraints are available here: https://www.nomadproject.io/docs/jobspec/index.html#operator

You can do regex or equality checking on attributes and you can also do distinct_host.

Reply all
Reply to author
Forward
0 new messages