You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

submit_job.go 1.1 kB

3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
1234567891011121314151617181920212223242526272829303132333435363738
  1. package main
  2. import (
  3. "code.gitlink.org.cn/JCCE/PCM.git/adaptor/pcm_slurm/cgo_tianhe/src/slurm"
  4. "code.gitlink.org.cn/JCCE/PCM.git/adaptor/pcm_slurm/cgo_tianhe/src/slurm/submitjob"
  5. )
  6. import "os/user"
  7. import "os"
  8. import "strconv"
  9. import "fmt"
  10. func main() {
  11. job_desc := submit_job.Job_descriptor{}
  12. job_desc.Script = "#! /bin/bash\n hostname \n env | grep SLURM "
  13. dir, _ := os.Getwd()
  14. user, _ := user.Current()
  15. userid, _ := strconv.Atoi(user.Uid)
  16. job_desc.User_id = uint32(userid)
  17. groupid, _ := strconv.Atoi(user.Gid)
  18. job_desc.Group_id = uint32(groupid)
  19. job_desc.Name = "test_job"
  20. job_desc.Partition = "long"
  21. job_desc.Time_limit = uint32(2)
  22. job_desc.Min_nodes = uint32(1)
  23. job_desc.Std_out = ("./out-%j.txt")
  24. job_desc.Std_err = ("./err-%j.txt")
  25. job_desc.Work_dir = dir
  26. job_desc.Environment = []string{"SLURM_GO_JOB=TRUE", "SLURM_CONTAINER_JOB=FALSE"}
  27. answer := submit_job.Submit_job(&job_desc)
  28. if answer.Error_code != 0 {
  29. msg := slurm.GetErrorString(answer.Error_code)
  30. fmt.Printf("Error: %s\n", msg)
  31. return
  32. }
  33. fmt.Printf("Submitted Job %d\n", answer.Job_id)
  34. }

PCM is positioned as Software stack over Cloud, aiming to build the standards and ecology of heterogeneous cloud collaboration for JCC in a non intrusive and autonomous peer-to-peer manner.