From 885f6e05bb19f3bdf89581972e121c50dfbebf6f Mon Sep 17 00:00:00 2001 From: Armon Dadgar Date: Mon, 7 Sep 2015 12:23:34 -0700 Subject: [PATCH] nomad: helper struct func --- nomad/structs/structs.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/nomad/structs/structs.go b/nomad/structs/structs.go index cfe14f813..4dc6da027 100644 --- a/nomad/structs/structs.go +++ b/nomad/structs/structs.go @@ -769,6 +769,16 @@ type TaskGroup struct { Meta map[string]string } +// LookupTask finds a task by name +func (tg *TaskGroup) LookupTask(name string) *Task { + for _, t := range tg.Tasks { + if t.Name == name { + return t + } + } + return nil +} + // Task is a single process typically that is executed as part of a task group. type Task struct { // Name of the task