This commit is contained in:
Diptanu Choudhury
2016-05-26 15:25:18 -07:00
parent f765e82a11
commit f16191c297
5 changed files with 6 additions and 11 deletions

View File

@@ -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

View File

@@ -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)
}

View File

@@ -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

View File

@@ -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)

View File

@@ -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 != "" {