Skip to content

Commit

Permalink
1.5.0 更新文件提交作业接口
Browse files Browse the repository at this point in the history
  • Loading branch information
test committed Jan 30, 2024
1 parent e30d8af commit 87b2296
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 16 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
ARCH ?= amd64

protos:
buf generate --template buf.gen.yaml https://github.com/PKUHPC/scow-scheduler-adapter-interface.git#subdir=protos,tag=v1.4.0
buf generate --template buf.gen.yaml https://github.com/PKUHPC/scow-scheduler-adapter-interface.git#subdir=protos,tag=v1.5.0

run:
go run *.go
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# slurm adapter for SCOW

当前实现的`scow-scheduluer-adapter-interface`版本:v1.3.0
当前实现的`scow-scheduluer-adapter-interface`版本:v1.5.0

## Build

Expand Down
28 changes: 14 additions & 14 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ func init() {

// version
func (s *serverVersion) GetVersion(ctx context.Context, in *pb.GetVersionRequest) (*pb.GetVersionResponse, error) {
return &pb.GetVersionResponse{Major: 1, Minor: 4, Patch: 0}, nil
return &pb.GetVersionResponse{Major: 1, Minor: 5, Patch: 0}, nil
}

// appservice
Expand Down Expand Up @@ -3532,19 +3532,19 @@ func (s *serverJob) SubmitScriptAsJob(ctx context.Context, in *pb.SubmitScriptAs
}

// 具体的提交逻辑
// updateScript := "#!/bin/bash\n"
// trimmedScript := strings.TrimLeft(in.Script, "\n") // 去除最前面的空行
// // 通过换行符 "\n" 分割字符串
// checkBool1 := strings.Contains(trimmedScript, "--chdir")
// checkBool2 := strings.Contains(trimmedScript, " -D ")
// if !checkBool1 && !checkBool2 {
// chdirString := fmt.Sprintf("#SBATCH --chdir=%s\n", *in.ScriptFileFullPath)
// updateScript = updateScript + chdirString
// for _, value := range strings.Split(trimmedScript, "\n")[1:] {
// updateScript = updateScript + value + "\n"
// }
// in.Script = updateScript
// }
updateScript := "#!/bin/bash\n"
trimmedScript := strings.TrimLeft(in.Script, "\n") // 去除最前面的空行
// 通过换行符 "\n" 分割字符串
checkBool1 := strings.Contains(trimmedScript, "--chdir")
checkBool2 := strings.Contains(trimmedScript, " -D ")
if !checkBool1 && !checkBool2 {
chdirString := fmt.Sprintf("#SBATCH --chdir=%s\n", *in.ScriptFileFullPath)
updateScript = updateScript + chdirString
for _, value := range strings.Split(trimmedScript, "\n")[1:] {
updateScript = updateScript + value + "\n"
}
in.Script = updateScript
}

submitResponse, err := utils.LocalSubmitJob(in.Script, in.UserId)
if err != nil {
Expand Down

0 comments on commit 87b2296

Please sign in to comment.