func (getter *JobGetter) Get(jobdata *models.JobData) {

	logger.INFO("[#cache#] getter get %s", jobdata.JobId)
	getter.Remove(jobdata.JobId)
	getter.Lock()
	defer getter.Unlock()
	jobbase, jobgeterror := getter.tryGetJobBase(jobdata)
	if jobgeterror != nil {
		jobget := &JobGet{JobId: jobdata.JobId, JobData: jobdata, JobBase: nil, State: GET_WAITING}
		go func() {
			getter.handler.OnJobGetterExceptionHandlerFunc("", jobget, jobgeterror)
		}()
		getter.gets[jobdata.JobId] = jobget
		getter.execute()
		return
	}
	workdir := getter.Root + "/" + jobbase.JobId + "/" + jobbase.FileCode
	if jobgeterror := getter.tryGetJobFile(workdir, jobbase); jobgeterror != nil {
		jobget := &JobGet{JobId: jobdata.JobId, JobData: jobdata, JobBase: jobbase, State: GET_WAITING}
		go func() {
			getter.handler.OnJobGetterExceptionHandlerFunc(workdir, jobget, jobgeterror)
		}()
		if jobgeterror.Code == ERROR_DECOMPRESS { //如果解压失败，不加入恢复gets尝试下载
			logger.ERROR("[#cache#] getter error %d, %s", jobgeterror.Code, jobgeterror.Error.Error())
			return
		}
		getter.gets[jobdata.JobId] = jobget
		getter.execute()
	} else {
		getter.save(jobbase) //写job.json
	}
	go func() { //=携程回调避免上层锁
		getter.handler.OnJobGetterHandlerFunc(workdir, jobbase)
	}()
}
//Get is exported
//get a jobbase and jobfile
Get is exported
get a jobbase and jobfile
// Get is exported // get a jobbase and jobfile
func (getter *JobGetter) Get(jobdata *models.JobData) {
	logger.INFO("[#cache#] getter get %s", jobdata.JobId)
	getter.Remove(jobdata.JobId)
	getter.Lock()
	defer getter.Unlock()
	jobbase, jobgeterror := getter.tryGetJobBase(jobdata)
	if jobgeterror != nil {
		jobget := &JobGet{JobId: jobdata.JobId, JobData: jobdata, JobBase: nil, State: GET_WAITING}
		go func() {
			getter.handler.OnJobGetterExceptionHandlerFunc("", jobget, jobgeterror)
		}()
		getter.gets[jobdata.JobId] = jobget
		getter.execute()
		return
	}
	workdir := getter.Root + "/" + jobbase.JobId + "/" + jobbase.FileCode
	if jobgeterror := getter.tryGetJobFile(workdir, jobbase); jobgeterror != nil {
		jobget := &JobGet{JobId: jobdata.JobId, JobData: jobdata, JobBase: jobbase, State: GET_WAITING}
		go func() {
			getter.handler.OnJobGetterExceptionHandlerFunc(workdir, jobget, jobgeterror)
		}()
		if jobgeterror.Code == ERROR_DECOMPRESS { 
			logger.ERROR("[#cache#] getter error %d, %s", jobgeterror.Code, jobgeterror.Error.Error())
			return
		}
		getter.gets[jobdata.JobId] = jobget
		getter.execute()
	} else {
		getter.save(jobbase) 
	}
	go func() { 
		getter.handler.OnJobGetterHandlerFunc(workdir, jobbase)
	}()
}
func ( getter * JobGetter ) Get ( jobdata * models . JobData ) { logger . INFO ( " " , jobdata . JobId ) getter . Remove ( jobdata . JobId ) getter . Lock ( ) defer getter . Unlock ( ) jobbase , jobgeterror := getter . tryGetJobBase ( jobdata ) if jobgeterror != nil { jobget := & JobGet { JobId : jobdata . JobId , JobData : jobdata , JobBase : nil , State : GET_WAITING } go func ( ) { getter . handler . OnJobGetterExceptionHandlerFunc ( " " , jobget , jobgeterror ) } ( ) getter . gets [ jobdata . JobId ] = jobget getter . execute ( ) return } workdir := getter . Root + " " + jobbase . JobId + " " + jobbase . FileCode if jobgeterror := getter . tryGetJobFile ( workdir , jobbase ) ; jobgeterror != nil { jobget := & JobGet { JobId : jobdata . JobId , JobData : jobdata , JobBase : jobbase , State : GET_WAITING } go func ( ) { getter . handler . OnJobGetterExceptionHandlerFunc ( workdir , jobget , jobgeterror ) } ( ) if jobgeterror . Code == ERROR_DECOMPRESS { logger . ERROR ( " " , jobgeterror . Code , jobgeterror . Error . Error ( ) ) return } getter . gets [ jobdata . JobId ] = jobget getter . execute ( ) } else { getter . save ( jobbase ) } go func ( ) { getter . handler . OnJobGetterHandlerFunc ( workdir , jobbase ) } ( ) }
Get is exported
get a jobbase and jobfile
Get is exported get a jobbase and jobfile
//如果解压失败，不加入恢复gets尝试下载 //写job.json //=携程回调避免上层锁