mirror of
https://github.com/zrepl/zrepl.git
synced 2024-11-29 03:45:27 +01:00
parent
0764f8824e
commit
0895e02844
@ -88,11 +88,11 @@ func (j *LocalJob) JobStart(ctx context.Context) {
|
|||||||
|
|
||||||
rootLog := ctx.Value(contextKeyLog).(Logger)
|
rootLog := ctx.Value(contextKeyLog).(Logger)
|
||||||
|
|
||||||
j.snapperTask = NewTask("snapshot", rootLog)
|
j.snapperTask = NewTask("snapshot", j, rootLog)
|
||||||
j.mainTask = NewTask("main", rootLog)
|
j.mainTask = NewTask("main", j, rootLog)
|
||||||
j.handlerTask = NewTask("handler", rootLog)
|
j.handlerTask = NewTask("handler", j, rootLog)
|
||||||
j.pruneRHSTask = NewTask("prune_rhs", rootLog)
|
j.pruneRHSTask = NewTask("prune_rhs", j, rootLog)
|
||||||
j.pruneLHSTask = NewTask("prune_lhs", rootLog)
|
j.pruneLHSTask = NewTask("prune_lhs", j, rootLog)
|
||||||
|
|
||||||
local := rpc.NewLocalRPC()
|
local := rpc.NewLocalRPC()
|
||||||
// Allow access to any dataset since we control what mapping
|
// 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)
|
log := ctx.Value(contextKeyLog).(Logger)
|
||||||
defer log.Info("exiting")
|
defer log.Info("exiting")
|
||||||
j.task = NewTask("main", log)
|
j.task = NewTask("main", j, log)
|
||||||
|
|
||||||
// j.task is idle here idle here
|
// j.task is idle here idle here
|
||||||
|
|
||||||
|
@ -81,9 +81,9 @@ func (j *SourceJob) JobStart(ctx context.Context) {
|
|||||||
log := ctx.Value(contextKeyLog).(Logger)
|
log := ctx.Value(contextKeyLog).(Logger)
|
||||||
defer log.Info("exiting")
|
defer log.Info("exiting")
|
||||||
|
|
||||||
j.autosnapTask = NewTask("autosnap", log)
|
j.autosnapTask = NewTask("autosnap", j, log)
|
||||||
j.pruneTask = NewTask("prune", log)
|
j.pruneTask = NewTask("prune", j, log)
|
||||||
j.serveTask = NewTask("serve", log)
|
j.serveTask = NewTask("serve", j, log)
|
||||||
|
|
||||||
a := IntervalAutosnap{j.autosnapTask, j.Filesystems, j.SnapshotPrefix, j.Interval}
|
a := IntervalAutosnap{j.autosnapTask, j.Filesystems, j.SnapshotPrefix, j.Interval}
|
||||||
p, err := j.Pruner(j.pruneTask, PrunePolicySideDefault, false)
|
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.
|
// An instance of Task tracks a single thread of activity that is part of a Job.
|
||||||
type Task struct {
|
type Task struct {
|
||||||
|
parent Job // immutable
|
||||||
|
|
||||||
// Stack of activities the task is currently in
|
// Stack of activities the task is currently in
|
||||||
// Members are instances of taskActivity
|
// Members are instances of taskActivity
|
||||||
activities *list.List
|
activities *list.List
|
||||||
@ -250,8 +252,9 @@ type taskActivity struct {
|
|||||||
progress *taskProgress
|
progress *taskProgress
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewTask(name string, lg *logger.Logger) *Task {
|
func NewTask(name string, parent Job, lg *logger.Logger) *Task {
|
||||||
t := &Task{
|
t := &Task{
|
||||||
|
parent: parent,
|
||||||
activities: list.New(),
|
activities: list.New(),
|
||||||
}
|
}
|
||||||
rootLogger := lg.ReplaceField(logTaskField, name).
|
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))
|
log.Printf("job dump:\n%s", pretty.Sprint(jobp))
|
||||||
|
|
||||||
task := NewTask("", log)
|
task := NewTask("", jobi, log)
|
||||||
pruner, err := jobp.Pruner(task, testPrunePolicyArgs.side, true)
|
pruner, err := jobp.Pruner(task, testPrunePolicyArgs.side, true)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Printf("cannot create test pruner: %s", err)
|
log.Printf("cannot create test pruner: %s", err)
|
||||||
|
Loading…
Reference in New Issue
Block a user