Track TaskGroup status during the Job execution and determine Task completion

105 views
Skip to first unread message

Henrique Gontijo

unread,
May 20, 2016, 2:21:28 PM5/20/16
to Nomad
Hi,

I have an use-case where a job is triggered with multiple taskgroups and each taskgroup has one task. During the job execution, we would like to know what's the task result as soon as the task is completed. My approach was to run one task / job and then track the job status until it reaches "dead" state so I can inspect task status (ClientStatus/DesiredStatus/TaskStates - status) however I'm not sure if that's appropriate and there's also the fact it creates an overhead of multiple jobs hence multiple APIs calls. The reason I've done that is because I noticed two cases where the allocation reaches terminal state however it does not necessarily mean the task reached a terminal state [1].

That said, here are my questions:
a) Is it possible to determine a task is in terminal (or complete or dead) state[2] without only looking into job status (dead)? If yes, how?
b) Once I determine the task is in terminal (or complete or dead) state, the task state details can be inspected on the events (Time determines the order)?
c) What do you guys thinks about having a Task status attribute?

[1]
// Allocation completes (technically killed) due to a job update triggering a new Evaluation -> Allocation
DesiredStatus: "stop",
DesiredDescription: "alloc not needed due to job update",
ClientStatus: "complete"

// Allocation failed due to resource constraint triggering a new Evaluation -> Allocation
DesiredStatus: "failed",
DesiredDescription: "failed to find a node for placement",
ClientStatus: "failed",

[2] Task is terminal means last allocation (determined by CreateTime) is terminal and no more evaluation will be created for this task.

Thanks!

Alex Dadgar

unread,
May 24, 2016, 12:53:04 PM5/24/16
to Henrique Gontijo, Nomad
Hey Henrique,

You can access the states of the tasks by querying the allocation endpoint. The returned response will include TaskStates.


This has the status of the task: Pending, Running, Dead and the individual events can be seen.

Thanks,
Alex

--
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/67e2b4d0-8ede-4b0d-8c17-9bf2a03df6a2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages