Skip to content

Commit

Permalink
Merge pull request #96 from tbs60/dev_tming
Browse files Browse the repository at this point in the history
fix bugs, issue: #95 #94
  • Loading branch information
tming authored Jul 27, 2023
2 parents 0a913ae + 7574da3 commit a222975
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/backend/booster/bk_dist/handler/ue4/cc/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,7 @@ func (cc *TaskCC) Includes(responseFile string, args []string, workdir string, f

// TOOD : maybe we should pass responseFile to calc md5, to ensure unique
var err error
cc.pumpHeadFile, err = getPumpIncludeFile(pumpdir, "pump_heads", ".txt", args)
cc.pumpHeadFile, err = getPumpIncludeFile(pumpdir, "pump_heads", ".txt", args, workdir)
if err != nil {
blog.Errorf("cc: do includes get output file failed: %v", err)
return nil, err
Expand Down
9 changes: 7 additions & 2 deletions src/backend/booster/bk_dist/handler/ue4/cc/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -1075,9 +1075,9 @@ func makeTmpFile(tmpDir, prefix, ext string) (string, error) {
return "", fmt.Errorf("cc: create tmp file failed: %s", target)
}

func getPumpIncludeFile(tmpDir, prefix, ext string, args []string) (string, error) {
func getPumpIncludeFile(tmpDir, prefix, ext string, args []string, workdir string) (string, error) {
fullarg := strings.Join(args, " ")
md5str := md5.Sum([]byte(fullarg))
md5str := md5.Sum([]byte((fullarg + workdir)))
target := filepath.Join(tmpDir, fmt.Sprintf("%s_%x%s", prefix, md5str, ext))

return target, nil
Expand Down Expand Up @@ -1201,6 +1201,10 @@ func saveResultFile(rf *dcSDK.FileDesc, dir string) error {
return fmt.Errorf("file path is empty")
}

if !filepath.IsAbs(fp) {
fp = filepath.Join(dir, fp)
}

f, err := os.Create(fp)
if err != nil {
if !filepath.IsAbs(fp) && dir != "" {
Expand Down Expand Up @@ -1282,6 +1286,7 @@ func saveResultFile(rf *dcSDK.FileDesc, dir string) error {
blog.Errorf("cc: save file [%s] error: [%v]", fp, err)
return err
}
blog.Infof("cc: succeed save file %s size [%d]", fp, outlen)
break
default:
return fmt.Errorf("cc: unknown compress type [%s]", rf.Compresstype)
Expand Down
4 changes: 2 additions & 2 deletions src/backend/booster/bk_dist/handler/ue4/cl/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -523,7 +523,7 @@ func (cl *TaskCL) Includes(responseFile string, args []string, workdir string, f

// TOOD : maybe we should pass responseFile to calc md5, to ensure unique
var err error
cl.pumpHeadFile, err = getPumpIncludeFile(pumpdir, "pump_heads", ".txt", args)
cl.pumpHeadFile, err = getPumpIncludeFile(pumpdir, "pump_heads", ".txt", args, workdir)
if err != nil {
blog.Errorf("cl: do includes get output file failed: %v", err)
return nil, err
Expand Down Expand Up @@ -958,7 +958,7 @@ func (cl *TaskCL) postExecute(r *dcSDK.BKDistResult) error {
goto ERROREND
}

blog.Debugf("cl: output [%s] errormessage [%s]", r.Results[0].OutputMessage, r.Results[0].ErrorMessage)
blog.Infof("cl: output [%s] errormessage [%s]", r.Results[0].OutputMessage, r.Results[0].ErrorMessage)

if r.Results[0].RetCode == 0 {
blog.Infof("cl: success done post execute for: %v", cl.originArgs)
Expand Down
9 changes: 7 additions & 2 deletions src/backend/booster/bk_dist/handler/ue4/cl/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -806,9 +806,9 @@ func makeTmpFile(tmpDir, prefix, ext string) (string, error) {
return "", fmt.Errorf("cl: create tmp file failed: %s", target)
}

func getPumpIncludeFile(tmpDir, prefix, ext string, args []string) (string, error) {
func getPumpIncludeFile(tmpDir, prefix, ext string, args []string, workdir string) (string, error) {
fullarg := strings.Join(args, " ")
md5str := md5.Sum([]byte(fullarg))
md5str := md5.Sum([]byte((fullarg + workdir)))
target := filepath.Join(tmpDir, fmt.Sprintf("%s_%x%s", prefix, md5str, ext))

return target, nil
Expand Down Expand Up @@ -919,6 +919,10 @@ func saveResultFile(rf *dcSDK.FileDesc, dir string) error {
return fmt.Errorf("file path is empty")
}

if !filepath.IsAbs(fp) {
fp = filepath.Join(dir, fp)
}

f, err := os.Create(fp)
if err != nil {
if !filepath.IsAbs(fp) && dir != "" {
Expand Down Expand Up @@ -1000,6 +1004,7 @@ func saveResultFile(rf *dcSDK.FileDesc, dir string) error {
blog.Errorf("cl: save file [%s] error: [%v]", fp, err)
return err
}
blog.Infof("cl: succeed save file %s size [%d]", fp, outlen)
break
default:
return fmt.Errorf("cl: unknown compress type [%s]", rf.Compresstype)
Expand Down

0 comments on commit a222975

Please sign in to comment.