[ARVADOS] updated: 1.1.0-23-g4a09e25
Git user
git at public.curoverse.com
Fri Oct 13 09:51:49 EDT 2017
Summary of changes:
sdk/go/keepclient/block_cache.go | 2 +-
sdk/go/keepclient/keepclient.go | 4 ++++
services/crunch-run/crunchrun.go | 4 +++-
services/crunch-run/crunchrun_test.go | 9 +++++++++
4 files changed, 17 insertions(+), 2 deletions(-)
via 4a09e252ea6dd94e14cdf5ddb324ccf574b42423 (commit)
from 6ee6e654bc873db10037c735a63697d295ec40cb (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 4a09e252ea6dd94e14cdf5ddb324ccf574b42423
Author: Peter Amstutz <peter.amstutz at curoverse.com>
Date: Fri Oct 13 09:50:30 2017 -0400
12447: Add ClearBlockCache method to KeepClient
Arvados-DCO-1.1-Signed-off-by: Peter Amstutz <pamstutz at veritasgenetics.com>
diff --git a/sdk/go/keepclient/block_cache.go b/sdk/go/keepclient/block_cache.go
index 18f7de9..23fd331 100644
--- a/sdk/go/keepclient/block_cache.go
+++ b/sdk/go/keepclient/block_cache.go
@@ -30,7 +30,7 @@ const defaultMaxBlocks = 4
// there are no more than MaxBlocks left.
func (c *BlockCache) Sweep() {
max := c.MaxBlocks
- if max < defaultMaxBlocks {
+ if max == 0 {
max = defaultMaxBlocks
}
c.mtx.Lock()
diff --git a/sdk/go/keepclient/keepclient.go b/sdk/go/keepclient/keepclient.go
index 8b518ac..bc7aa24 100644
--- a/sdk/go/keepclient/keepclient.go
+++ b/sdk/go/keepclient/keepclient.go
@@ -434,6 +434,10 @@ func (kc *KeepClient) cache() *BlockCache {
}
}
+func (kc *KeepClient) ClearBlockCache() {
+ kc.cache().Clear()
+}
+
var (
// There are four global http.Client objects for the four
// possible permutations of TLS behavior (verify/skip-verify)
diff --git a/services/crunch-run/crunchrun.go b/services/crunch-run/crunchrun.go
index 6d4b06b..8d437a8 100644
--- a/services/crunch-run/crunchrun.go
+++ b/services/crunch-run/crunchrun.go
@@ -55,6 +55,7 @@ var ErrCancelled = errors.New("Cancelled")
type IKeepClient interface {
PutHB(hash string, buf []byte) (string, int, error)
ManifestFileReader(m manifest.Manifest, filename string) (arvados.File, error)
+ ClearBlockCache()
}
// NewLogWriter is a factory function to create a new log writer.
@@ -265,7 +266,7 @@ func (runner *ContainerRunner) LoadImage() (err error) {
runner.ContainerConfig.Image = imageID
- keepclient.DefaultBlockCache.Clear()
+ runner.Kc.ClearBlockCache()
return nil
}
@@ -1452,6 +1453,7 @@ func main() {
if err != nil {
log.Fatalf("%s: %v", containerId, err)
}
+ kc.BlockCache = &keepclient.BlockCache{MaxBlocks: 2}
kc.Retries = 4
var docker *dockerclient.Client
diff --git a/services/crunch-run/crunchrun_test.go b/services/crunch-run/crunchrun_test.go
index 474ba5d..5e77d7b 100644
--- a/services/crunch-run/crunchrun_test.go
+++ b/services/crunch-run/crunchrun_test.go
@@ -312,6 +312,9 @@ func (client *KeepTestClient) PutHB(hash string, buf []byte) (string, int, error
return fmt.Sprintf("%s+%d", hash, len(buf)), len(buf), nil
}
+func (*KeepTestClient) ClearBlockCache() {
+}
+
type FileWrapper struct {
io.ReadCloser
len int64
@@ -417,12 +420,18 @@ func (KeepErrorTestClient) ManifestFileReader(m manifest.Manifest, filename stri
return nil, errors.New("KeepError")
}
+func (KeepErrorTestClient) ClearBlockCache() {
+}
+
type KeepReadErrorTestClient struct{}
func (KeepReadErrorTestClient) PutHB(hash string, buf []byte) (string, int, error) {
return "", 0, nil
}
+func (KeepReadErrorTestClient) ClearBlockCache() {
+}
+
type ErrorReader struct{}
func (ErrorReader) Read(p []byte) (n int, err error) {
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list