mirror of
https://github.com/kemko/nomad.git
synced 2026-01-05 09:55:44 +03:00
Making the plugin server return the same instance of executor rpc server
This commit is contained in:
@@ -192,10 +192,11 @@ func (e *UniversalExecutor) Exit() error {
|
||||
if e.cmd.Process != nil {
|
||||
proc, err := os.FindProcess(e.cmd.Process.Pid)
|
||||
if err != nil {
|
||||
e.logger.Printf("[ERROR] can't find process with pid: %v, err: %v", e.cmd.Process.Pid, err)
|
||||
}
|
||||
if err := proc.Kill(); err != nil {
|
||||
e.logger.Printf("[ERROR] can't kill process with pid: %v, err: %v", e.cmd.Process.Pid, err)
|
||||
e.logger.Printf("[ERROR] executor: can't find process with pid: %v, err: %v",
|
||||
e.cmd.Process.Pid, err)
|
||||
} else if err := proc.Kill(); err != nil {
|
||||
merr.Errors = append(merr.Errors,
|
||||
fmt.Errorf("can't kill process with pid: %v, err: %v", e.cmd.Process.Pid, err))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -230,11 +231,12 @@ func (e *UniversalExecutor) ShutDown() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// configureTaskDir sets the task dir in the executor
|
||||
func (e *UniversalExecutor) configureTaskDir() error {
|
||||
taskDir, ok := e.ctx.AllocDir.TaskDirs[e.ctx.TaskName]
|
||||
e.taskDir = taskDir
|
||||
if !ok {
|
||||
return fmt.Errorf("Couldn't find task directory for task %v", e.ctx.TaskName)
|
||||
return fmt.Errorf("couldn't find task directory for task %v", e.ctx.TaskName)
|
||||
}
|
||||
e.cmd.Dir = taskDir
|
||||
return nil
|
||||
|
||||
@@ -106,10 +106,14 @@ func (e *ExecutorRPCServer) Exit(args interface{}, resp *interface{}) error {
|
||||
|
||||
type ExecutorPlugin struct {
|
||||
logger *log.Logger
|
||||
Impl *ExecutorRPCServer
|
||||
}
|
||||
|
||||
func (p *ExecutorPlugin) Server(*plugin.MuxBroker) (interface{}, error) {
|
||||
return &ExecutorRPCServer{Impl: executor.NewExecutor(p.logger)}, nil
|
||||
if p.Impl == nil {
|
||||
p.Impl = &ExecutorRPCServer{Impl: executor.NewExecutor(p.logger)}
|
||||
}
|
||||
return p.Impl, nil
|
||||
}
|
||||
|
||||
func (p *ExecutorPlugin) Client(b *plugin.MuxBroker, c *rpc.Client) (interface{}, error) {
|
||||
|
||||
Reference in New Issue
Block a user