-// finalizeRecordOnFinish uses 'strigger' command to register a script that will run on
-// the slurm controller when the job finishes.
-func finalizeRecordOnFinish(jobid, containerUUID, finishCommand string, arv arvadosclient.ArvadosClient) {
- insecure := "0"
- if arv.ApiInsecure {
- insecure = "1"
- }
- cmd := striggerCmd(jobid, containerUUID, finishCommand, arv.ApiServer, arv.ApiToken, insecure)
- cmd.Stdout = os.Stdout
- cmd.Stderr = os.Stderr
- err := cmd.Run()
- if err != nil {
- log.Printf("While setting up strigger: %v", err)
- // BUG: we drop the error here and forget about it. A
- // human has to notice the container is stuck in
- // Running state, and fix it manually.
- }
-}
-
-func checkSqueue(uuid string) (bool, error) {
- cmd := squeueCmd()
- sq, err := cmd.StdoutPipe()
- if err != nil {
- return false, err
- }
- cmd.Start()
- defer cmd.Wait()
- scanner := bufio.NewScanner(sq)
- found := false
- for scanner.Scan() {
- if scanner.Text() == uuid {
- found = true
- }
- }
- if err := scanner.Err(); err != nil {
- return false, err
- }
- return found, nil
-}
-
-// Run or monitor a container.
-//