func resetTask(task *Task, info *Info) { task.Info = info task.State = TASK_STAT_PENDING task.RemainWork = task.TotalWork task.ComputeTime = 0 task.CompletedDate = time.Time{} // reset all inputs with an origin for _, input := range task.Inputs { if input.Origin != "" { input.Node = "-" input.Url = "" input.Size = 0 } } // reset / delete all outputs for _, output := range task.Outputs { if dataUrl, _ := output.DataUrl(); dataUrl != "" { // delete dataUrl if is shock node if strings.HasSuffix(dataUrl, shock.DATA_SUFFIX) { if err := shock.ShockDelete(output.Host, output.Node, output.DataToken); err == nil { logger.Debug(2, fmt.Sprintf("Deleted node %s from shock", output.Node)) } else { logger.Error(fmt.Sprintf("resetTask: unable to deleted node %s from shock: %s", output.Node, err.Error())) } } } output.Node = "-" output.Url = "" output.Size = 0 } // delete all workunit logs for _, log := range conf.WORKUNIT_LOGS { deleteStdLogByTask(task.Id, log) } }
func (io *IO) DeleteNode() (nodeid string, err error) { if io.Delete { if err := shock.ShockDelete(io.Host, io.Node, io.DataToken); err != nil { return io.Node, err } return io.Node, nil } return "", nil }