diff --git a/api/allocations.go b/api/allocations.go index 5d0a028f4..05798cf5c 100644 --- a/api/allocations.go +++ b/api/allocations.go @@ -65,14 +65,6 @@ func (a *Allocations) Stats(alloc *Allocation, q *QueryOptions) (map[string]*Tas return res, nil } -func getErrorMsg(resp *http.Response) error { - if errMsg, err := ioutil.ReadAll(resp.Body); err == nil { - return fmt.Errorf(string(errMsg)) - } else { - return err - } -} - // Allocation is used for serialization of allocations. type Allocation struct { ID string diff --git a/api/api.go b/api/api.go index c156b5551..2b40a24b1 100644 --- a/api/api.go +++ b/api/api.go @@ -399,8 +399,6 @@ func parseWriteMeta(resp *http.Response, q *WriteMeta) error { // decodeBody is used to JSON decode a body func decodeBody(resp *http.Response, out interface{}) error { - //res, _ := ioutil.ReadAll(resp.Body) - //fmt.Fprintf(os.Stdout, "DIPTANU BODY %v", res) dec := json.NewDecoder(resp.Body) return dec.Decode(out) } diff --git a/client/client.go b/client/client.go index 3f7d33d4e..833e93849 100644 --- a/client/client.go +++ b/client/client.go @@ -130,6 +130,7 @@ type Client struct { consulService *consul.ConsulService + // HostStatsCollector collects host resource usage stats hostStatsCollector *stats.HostStatsCollector resourceUsage *stats.RingBuff resourceUsageLock sync.RWMutex diff --git a/client/driver/executor/executor_linux.go b/client/driver/executor/executor_linux.go index 4020c8e71..43fa4a36f 100644 --- a/client/driver/executor/executor_linux.go +++ b/client/driver/executor/executor_linux.go @@ -259,6 +259,10 @@ func (e *UniversalExecutor) removeChrootMounts() error { return e.ctx.AllocDir.UnmountAll() } +// getAllPids returns the pids of all the processes spun up by the executor. We +// use the libcontainer apis to get the pids when the user is using cgroup +// isolation and we scan the entire process table if the user is not using any +// isolation func (e *UniversalExecutor) getAllPids() ([]*nomadPid, error) { if e.command.ResourceLimits { manager := getCgroupManager(e.groups, e.cgPaths) diff --git a/command/agent/alloc_endpoint.go b/command/agent/alloc_endpoint.go index 4d43ed5de..ad62f75ad 100644 --- a/command/agent/alloc_endpoint.go +++ b/command/agent/alloc_endpoint.go @@ -72,7 +72,7 @@ func (s *HTTPServer) ClientAllocRequest(resp http.ResponseWriter, req *http.Requ clientStats := s.agent.client.StatsReporter() allocStats, ok := clientStats.AllocStats()[allocID] if !ok { - return nil, CodedError(404, "alloc not running in node") + return nil, CodedError(404, "alloc not running on node") } if task := req.URL.Query().Get("task"); task != "" {