Skip to content

Commit

Permalink
make golangci-lint happy
Browse files Browse the repository at this point in the history
Signed-off-by: Eduardo Arango <[email protected]>
  • Loading branch information
ArangoGutierrez committed Apr 24, 2019
1 parent 23abb4c commit bd5b4bc
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 46 deletions.
14 changes: 0 additions & 14 deletions pkg/plugin/prepare.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,25 +9,11 @@ import (
"fmt"
"io"
"io/ioutil"
"os/exec"
"path/filepath"

"github.com/hashicorp/nomad/client/lib/fifo"
"github.com/hashicorp/nomad/plugins/drivers"
)

func getAbsolutePath(bin string) (string, error) {
lp, err := exec.LookPath(bin)
if err != nil {
lp, err = exec.LookPath(singularityCmd)
if err != nil {
return "", fmt.Errorf("failed to resolve path to %q executable: %v", bin, err)
}
}

return filepath.EvalSymlinks(lp)
}

// prepareContainer preloads the taskcnf into args to be apssed to a execCmd
func prepareContainer(cfg *drivers.TaskConfig, taskCfg TaskConfig) syexec {
argv := make([]string, 0, 50)
Expand Down
44 changes: 12 additions & 32 deletions pkg/plugin/singularity.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ package singularity

import (
"io"
"os"
"os/exec"
"strings"
"syscall"
Expand All @@ -18,22 +17,6 @@ import (
)

const (
// RuntimeName is the official name of Singularity runtime.
runtimeName = "singularity"

// StarterName is the name of executable that is responsible for runtime start.
starterName = "starter"

// LibraryURL is a default singularity library server address.
libraryURL = "https://library.sylabs.io"

// LibraryDomain holds the sylabs cloud library primary domain.
// For more info refer to https://cloud.sylabs.io/library.
libraryDomain = "cloud.sylabs.io"

// KeysServer is a default singularity key management and verification server.
keysServer = "https://keys.sylabs.io"

// defaultFailedCode for singularity runtime
defaultFailedCode = 255
)
Expand All @@ -43,12 +26,9 @@ type syexec struct {
cmd *exec.Cmd
taskConfig TaskConfig
cfg *drivers.TaskConfig
stdoutPath string
stdout io.WriteCloser
stderrPath string
stderr io.WriteCloser
env []string
user string
TaskDir string
state *psState
containerPid int
Expand Down Expand Up @@ -112,15 +92,15 @@ func (s *syexec) startContainer(commandCfg *drivers.TaskConfig) error {

// waitTillStopped blocks and returns true when container exit;
// returns false with an error message if the container processes cannot be identified.
func (s *syexec) waitTillStopped() (bool, error) {
ps, err := os.FindProcess(s.containerPid)
if err != nil {
return false, err
}

for {
if err := ps.Signal(syscall.Signal(0)); err != nil {
return true, nil
}
}
}
// func (s *syexec) waitTillStopped() (bool, error) {
// ps, err := os.FindProcess(s.containerPid)
// if err != nil {
// return false, err
// }

// for {
// if err := ps.Signal(syscall.Signal(0)); err != nil {
// return true, nil
// }
// }
// }

0 comments on commit bd5b4bc

Please sign in to comment.