Skip to content

Commit

Permalink
Merge pull request #2 from trivago/improved-pot-container-naming
Browse files Browse the repository at this point in the history
Improved naming for pot to handle multiple tasks
  • Loading branch information
ebarriosjr authored Aug 23, 2019
2 parents 09b31a7 + 7ba5e6e commit 876ab19
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
5 changes: 4 additions & 1 deletion driver/handle.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,13 +77,16 @@ func (h *taskHandle) run() {
// before killing the container with SIGKILL.
func (h *taskHandle) shutdown(timeout time.Duration) error {
// Wait for the process to finish or kill it after a timeout (whichever happens first):
var fixTimeOut time.Duration
fixTimeOut = 5 * time.Second

h.procState = drivers.TaskStateExited
done := make(chan error, 1)
go func() {
done <- h.syexec.cmd.Wait()
}()
select {
case <-time.After(timeout * time.Second):
case <-time.After(fixTimeOut * time.Second):

if err := h.syexec.cmd.Process.Kill(); err != nil {
return fmt.Errorf("failed to kill process: %v ", err)
Expand Down
3 changes: 2 additions & 1 deletion driver/prepare.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ func prepareContainer(cfg *drivers.TaskConfig, taskCfg TaskConfig) syexec {
}
}

argv = append(argv, "-n", cfg.JobName, "-v")
completeName := cfg.JobName + cfg.TaskGroupName
argv = append(argv, "-n", completeName, "-v")

se.argvCreate = append(argv, taskCfg.Args...)

Expand Down

0 comments on commit 876ab19

Please # to comment.