示例#1
0
文件: job.go 项目: callistoaz/3
// remove job output
func Rm(URL string) string {
	err := httpfs.Remove("http://" + OutputDir(URL))

	// update status after output removal
	UpdateJob(URL)

	if err != nil {
		return err.Error()
	}

	// report re-queue
	// handy if others remove your jobs
	job := JobByName(URL)
	if job != nil {
		job.RequeCount++
	}

	// make sure job runs again quickly
	user := JobUser(URL)
	u := Users[user]
	if u != nil {
		u.nextPtr = 0
	}
	return ""
}
示例#2
0
文件: od.go 项目: callistoaz/3
// SetOD sets the output directory where auto-saved files will be stored.
// The -o flag can also be used for this purpose.
func InitIO(inputfile, od string, force bool) {
	if outputdir != "" {
		panic("output directory already set")
	}

	InputFile = inputfile
	if !strings.HasSuffix(od, "/") {
		od += "/"
	}
	outputdir = od
	if strings.HasPrefix(outputdir, "http://") {
		httpfs.SetWD(outputdir + "/../")
	}
	LogOut("output directory:", outputdir)

	if force {
		httpfs.Remove(od)
	}

	_ = httpfs.Mkdir(od)

	initLog()
}
示例#3
0
文件: job.go 项目: callistoaz/3
// Put job back in queue for later, e.g., when killed.
func (j *Job) Reque() {
	log.Println("requeue", j.ID)
	j.RequeCount++
	httpfs.Remove(j.LocalOutputDir())
	j.Update()
}