[ARVADOS] created: 4adea935872d06d3f10a428553e6ce7159c5460f
git at public.curoverse.com
git at public.curoverse.com
Wed May 6 22:54:57 EDT 2015
at 4adea935872d06d3f10a428553e6ce7159c5460f (commit)
commit 4adea935872d06d3f10a428553e6ce7159c5460f
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 1a22e26..e09aeac 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