[ARVADOS] updated: 1.1.4-702-g85f6919fa
Git user
git at public.curoverse.com
Tue Jul 24 16:17:57 EDT 2018
Summary of changes:
lib/crunchstat/crunchstat.go | 17 ++++++++++++++---
services/crunch-run/crunchrun.go | 1 +
2 files changed, 15 insertions(+), 3 deletions(-)
via 85f6919fae720c41474e60f5c21710f70e446070 (commit)
from b211e857d304f7fbe8787d2b65a307da841d047b (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 85f6919fae720c41474e60f5c21710f70e446070
Author: Lucas Di Pentima <ldipentima at veritasgenetics.com>
Date: Tue Jul 24 17:15:21 2018 -0300
12444: Allow crunch-run to provide tmpdir to crunchstat
Also, get the temp dir from $TMPDIR if not provided, fix the 'used'
space calculation, and report which dir is being monitored.
Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima <ldipentima at veritasgenetics.com>
diff --git a/lib/crunchstat/crunchstat.go b/lib/crunchstat/crunchstat.go
index 714e7929a..8afe82819 100644
--- a/lib/crunchstat/crunchstat.go
+++ b/lib/crunchstat/crunchstat.go
@@ -53,6 +53,9 @@ type Reporter struct {
// Interval between samples. Must be positive.
PollPeriod time.Duration
+ // Temporary directory, will be monitored for available, used & total space.
+ TempDir string
+
// Where to write statistics. Must not be nil.
Logger *log.Logger
@@ -314,7 +317,7 @@ type diskSpaceSample struct {
func (r *Reporter) doDiskSpaceStats() {
s := syscall.Statfs_t{}
- err := syscall.Statfs("/tmp", &s)
+ err := syscall.Statfs(r.TempDir, &s)
if err != nil {
return
}
@@ -323,7 +326,7 @@ func (r *Reporter) doDiskSpaceStats() {
hasData: true,
sampleTime: time.Now(),
total: s.Blocks * bs,
- used: (s.Blocks - s.Bavail) * bs,
+ used: (s.Blocks - s.Bfree) * bs,
available: s.Bavail * bs,
}
@@ -335,7 +338,7 @@ func (r *Reporter) doDiskSpaceStats() {
interval,
int64(nextSample.used-prev.used))
}
- r.Logger.Printf("tmpdir available:%d used:%d total:%d%s\n",
+ r.Logger.Printf("statfs %d available %d used %d total%s\n",
nextSample.available, nextSample.used, nextSample.total, delta)
r.lastDiskSpaceSample = nextSample
}
@@ -422,6 +425,14 @@ func (r *Reporter) run() {
r.lastNetSample = make(map[string]ioSample)
r.lastDiskIOSample = make(map[string]ioSample)
+ if len(r.TempDir) == 0 {
+ // Temporary dir not provided, try to get it from the environment.
+ r.TempDir = os.Getenv("TMPDIR")
+ }
+ if len(r.TempDir) > 0 {
+ r.Logger.Printf("notice: monitoring temp dir %s\n", r.TempDir)
+ }
+
ticker := time.NewTicker(r.PollPeriod)
for {
r.doMemoryStats()
diff --git a/services/crunch-run/crunchrun.go b/services/crunch-run/crunchrun.go
index 098c53f8a..0a980b9ce 100644
--- a/services/crunch-run/crunchrun.go
+++ b/services/crunch-run/crunchrun.go
@@ -742,6 +742,7 @@ func (runner *ContainerRunner) startCrunchstat() error {
CgroupParent: runner.expectCgroupParent,
CgroupRoot: runner.cgroupRoot,
PollPeriod: runner.statInterval,
+ TempDir: runner.parentTemp,
}
runner.statReporter.Start()
return nil
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list