mirror of
https://github.com/zrepl/zrepl.git
synced 2024-12-23 15:38:49 +01:00
parent
0764f8824e
commit
0895e02844
@ -88,11 +88,11 @@ func (j *LocalJob) JobStart(ctx context.Context) {
|
||||
|
||||
rootLog := ctx.Value(contextKeyLog).(Logger)
|
||||
|
||||
j.snapperTask = NewTask("snapshot", rootLog)
|
||||
j.mainTask = NewTask("main", rootLog)
|
||||
j.handlerTask = NewTask("handler", rootLog)
|
||||
j.pruneRHSTask = NewTask("prune_rhs", rootLog)
|
||||
j.pruneLHSTask = NewTask("prune_lhs", rootLog)
|
||||
j.snapperTask = NewTask("snapshot", j, rootLog)
|
||||
j.mainTask = NewTask("main", j, rootLog)
|
||||
j.handlerTask = NewTask("handler", j, rootLog)
|
||||
j.pruneRHSTask = NewTask("prune_rhs", j, rootLog)
|
||||
j.pruneLHSTask = NewTask("prune_lhs", j, rootLog)
|
||||
|
||||
local := rpc.NewLocalRPC()
|
||||
// Allow access to any dataset since we control what mapping
|
||||
|
@ -98,7 +98,7 @@ func (j *PullJob) JobStart(ctx context.Context) {
|
||||
|
||||
log := ctx.Value(contextKeyLog).(Logger)
|
||||
defer log.Info("exiting")
|
||||
j.task = NewTask("main", log)
|
||||
j.task = NewTask("main", j, log)
|
||||
|
||||
// j.task is idle here idle here
|
||||
|
||||
|
@ -81,9 +81,9 @@ func (j *SourceJob) JobStart(ctx context.Context) {
|
||||
log := ctx.Value(contextKeyLog).(Logger)
|
||||
defer log.Info("exiting")
|
||||
|
||||
j.autosnapTask = NewTask("autosnap", log)
|
||||
j.pruneTask = NewTask("prune", log)
|
||||
j.serveTask = NewTask("serve", log)
|
||||
j.autosnapTask = NewTask("autosnap", j, log)
|
||||
j.pruneTask = NewTask("prune", j, log)
|
||||
j.serveTask = NewTask("serve", j, log)
|
||||
|
||||
a := IntervalAutosnap{j.autosnapTask, j.Filesystems, j.SnapshotPrefix, j.Interval}
|
||||
p, err := j.Pruner(j.pruneTask, PrunePolicySideDefault, false)
|
||||
|
@ -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).
|
||||
|
@ -170,7 +170,7 @@ func doTestPrunePolicy(cmd *cobra.Command, args []string) {
|
||||
|
||||
log.Printf("job dump:\n%s", pretty.Sprint(jobp))
|
||||
|
||||
task := NewTask("", log)
|
||||
task := NewTask("", jobi, log)
|
||||
pruner, err := jobp.Pruner(task, testPrunePolicyArgs.side, true)
|
||||
if err != nil {
|
||||
log.Printf("cannot create test pruner: %s", err)
|
||||
|
Loading…
Reference in New Issue
Block a user