[ARVADOS] updated: 3bb46b45d572286721530aea8dc1ec068cf8ffea

git at public.curoverse.com git at public.curoverse.com
Thu Oct 15 10:52:51 EDT 2015


Summary of changes:
 tools/keep-rsync/keep-rsync.go | 35 ++++++++++++-----------------------
 1 file changed, 12 insertions(+), 23 deletions(-)

       via  3bb46b45d572286721530aea8dc1ec068cf8ffea (commit)
       via  2d02430766b915675ce09899e554cd48e6dba036 (commit)
      from  845f7b9048d4b674a05e04fe919f2eb37479b1a0 (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 3bb46b45d572286721530aea8dc1ec068cf8ffea
Author: Tom Clegg <tom at curoverse.com>
Date:   Thu Oct 15 10:50:13 2015 -0400

    7167: Rename conf flags to -src and -dst to match arv-copy. Always add .conf for short form.

diff --git a/tools/keep-rsync/keep-rsync.go b/tools/keep-rsync/keep-rsync.go
index d47efd8..c39f067 100644
--- a/tools/keep-rsync/keep-rsync.go
+++ b/tools/keep-rsync/keep-rsync.go
@@ -24,13 +24,13 @@ func main() {
 
 	flag.StringVar(
 		&srcConfigFile,
-		"src-config-file",
+		"src",
 		"",
 		"Source configuration filename. May be either a pathname to a config file, or (for example) 'foo' as shorthand for $HOME/.config/arvados/foo.conf")
 
 	flag.StringVar(
 		&dstConfigFile,
-		"dst-config-file",
+		"dst",
 		"",
 		"Destination configuration filename. May be either a pathname to a config file, or (for example) 'foo' as shorthand for $HOME/.config/arvados/foo.conf")
 
@@ -117,10 +117,7 @@ var matchTrue = regexp.MustCompile("^(?i:1|yes|true)$")
 // Read config from file
 func readConfigFromFile(filename string) (config apiConfig, blobSigningKey string, err error) {
 	if !strings.Contains(filename, "/") {
-		filename = os.Getenv("HOME") + "/.config/arvados/" + filename
-		if !strings.HasSuffix(filename, ".conf") {
-			filename = filename + ".conf"
-		}
+		filename = os.Getenv("HOME") + "/.config/arvados/" + filename + ".conf"
 	}
 
 	content, err := ioutil.ReadFile(filename)

commit 2d02430766b915675ce09899e554cd48e6dba036
Author: Tom Clegg <tom at curoverse.com>
Date:   Thu Oct 15 10:48:33 2015 -0400

    7167: Fix up progress/ETA logging.

diff --git a/tools/keep-rsync/keep-rsync.go b/tools/keep-rsync/keep-rsync.go
index a536287..d47efd8 100644
--- a/tools/keep-rsync/keep-rsync.go
+++ b/tools/keep-rsync/keep-rsync.go
@@ -256,13 +256,18 @@ func getMissingLocators(srcLocators, dstLocators map[string]bool) []string {
 
 // Copy blocks from src to dst; only those that are missing in dst are copied
 func copyBlocksToDst(toBeCopied []string, kcSrc, kcDst *keepclient.KeepClient, blobSigningKey string) error {
-	done := 0
 	total := len(toBeCopied)
 
 	startedAt := time.Now()
-	var blockTime int64
-	for _, locator := range toBeCopied {
-		log.Printf("Getting block %d of %d: %v", done+1, total, locator)
+	for done, locator := range toBeCopied {
+		if done == 0 {
+			log.Printf("Copying data block %d of %d (%.2f%% done): %v", done+1, total,
+				float64(done)/float64(total)*100, locator)
+		} else {
+			timePerBlock := time.Since(startedAt) / time.Duration(done)
+			log.Printf("Copying data block %d of %d (%.2f%% done, ETA %v): %v", done+1, total,
+				float64(done)/float64(total)*100, timePerBlock*time.Duration(total-done), locator)
+		}
 
 		getLocator := locator
 		expiresAt := time.Now().AddDate(0, 0, 1)
@@ -275,23 +280,10 @@ func copyBlocksToDst(toBeCopied []string, kcSrc, kcDst *keepclient.KeepClient, b
 			return fmt.Errorf("Error getting block: %v %v", locator, err)
 		}
 
-		if done == 0 {
-			log.Printf("Copying data block %d of %d (%.2f%% done): %v", done+1, total,
-				float64(done)/float64(total)*100, locator)
-		} else {
-			log.Printf("Copying data block %d of %d (%.2f%% done, ETA %v): %v", done+1, total,
-				float64(done)/float64(total)*100, time.Duration(blockTime*int64(total-done)), locator)
-		}
 		_, _, err = kcDst.PutHR(getLocator[:32], reader, len)
 		if err != nil {
 			return fmt.Errorf("Error copying data block: %v %v", locator, err)
 		}
-
-		if done == 0 {
-			blockTime = int64(time.Now().Sub(startedAt))
-		}
-
-		done++
 	}
 
 	log.Printf("Successfully copied to destination %d blocks.", total)

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list