daemon: Task: track relation to parent job

refs #67
This commit is contained in:
Christian Schwarz
2018-04-05 22:18:22 +02:00
parent 0764f8824e
commit 0895e02844
5 changed files with 14 additions and 11 deletions

View File

@ -178,6 +178,8 @@ type TaskStatus struct {
// An instance of Task tracks a single thread of activity that is part of a Job.
type Task struct {
parent Job // immutable
// Stack of activities the task is currently in
// Members are instances of taskActivity
activities *list.List
@ -250,8 +252,9 @@ type taskActivity struct {
progress *taskProgress
}
func NewTask(name string, lg *logger.Logger) *Task {
func NewTask(name string, parent Job, lg *logger.Logger) *Task {
t := &Task{
parent: parent,
activities: list.New(),
}
rootLogger := lg.ReplaceField(logTaskField, name).