[ARVADOS] updated: 31d8ece649c63b008ed79a930a5b237ec795ff22

git at public.curoverse.com git at public.curoverse.com
Fri May 8 02:41:30 EDT 2015


Summary of changes:
 services/crunchstat/crunchstat.go | 18 +++++++++++++-----
 1 file changed, 13 insertions(+), 5 deletions(-)

       via  31d8ece649c63b008ed79a930a5b237ec795ff22 (commit)
       via  81d100b157dee4f24d376cdd8b5d739b385c925e (commit)
      from  fde21d34d011af2123668983c559632221390fd4 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


commit 31d8ece649c63b008ed79a930a5b237ec795ff22
Merge: fde21d3 81d100b
Author: Tom Clegg <tom at curoverse.com>
Date:   Fri May 8 02:42:08 2015 -0400

    Merge branch '4882-no-host-when-container' closes #4882


commit 81d100b157dee4f24d376cdd8b5d739b385c925e
Author: Tom Clegg <tom at curoverse.com>
Date:   Wed May 6 22:57:06 2015 -0400

    4882: If -cgroup-cid flag is given, only read container stats. If not given, only read host stats.

diff --git a/services/crunchstat/crunchstat.go b/services/crunchstat/crunchstat.go
index 1982223..e149124 100644
--- a/services/crunchstat/crunchstat.go
+++ b/services/crunchstat/crunchstat.go
@@ -86,11 +86,19 @@ var reportedStatFile = map[string]string{}
 // cgroup root for the given statgroup. (This will avoid falling back
 // to host-level stats during container setup and teardown.)
 func OpenStatFile(cgroup Cgroup, statgroup string, stat string) (*os.File, error) {
-	var paths = []string{
-		fmt.Sprintf("%s/%s/%s/%s/%s", cgroup.root, statgroup, cgroup.parent, cgroup.cid, stat),
-		fmt.Sprintf("%s/%s/%s/%s", cgroup.root, cgroup.parent, cgroup.cid, stat),
-		fmt.Sprintf("%s/%s/%s", cgroup.root, statgroup, stat),
-		fmt.Sprintf("%s/%s", cgroup.root, stat),
+	var paths []string
+	if cgroup.cid != "" {
+		// Collect container's stats
+		paths = []string{
+			fmt.Sprintf("%s/%s/%s/%s/%s", cgroup.root, statgroup, cgroup.parent, cgroup.cid, stat),
+			fmt.Sprintf("%s/%s/%s/%s", cgroup.root, cgroup.parent, cgroup.cid, stat),
+		}
+	} else {
+		// Collect this host's stats
+		paths = []string{
+			fmt.Sprintf("%s/%s/%s", cgroup.root, statgroup, stat),
+			fmt.Sprintf("%s/%s", cgroup.root, stat),
+		}
 	}
 	var path string
 	var file *os.File

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list