[ARVADOS] created: 668cf29c1a7f8270ed5ef0bcfbe693618a8155da

git at public.curoverse.com git at public.curoverse.com
Thu Nov 5 09:41:52 EST 2015


        at  668cf29c1a7f8270ed5ef0bcfbe693618a8155da (commit)


commit 668cf29c1a7f8270ed5ef0bcfbe693618a8155da
Author: radhika <radhika at curoverse.com>
Date:   Thu Nov 5 09:39:04 2015 -0500

    7490: The makeArvadosClient func, which is invoked by singlerun, should return error; not fatalf.
    The main method expects error in all error cases and decides next action; when wait time in makeArvadosClient is provided it will retry.

diff --git a/services/datamanager/datamanager.go b/services/datamanager/datamanager.go
index a9306ce..b81cf7e 100644
--- a/services/datamanager/datamanager.go
+++ b/services/datamanager/datamanager.go
@@ -42,7 +42,11 @@ func init() {
 func main() {
 	flag.Parse()
 	if minutesBetweenRuns == 0 {
-		err := singlerun(makeArvadosClient())
+		arv, err := makeArvadosClient()
+		if err != nil {
+			log.Fatalf("makeArvadosClient: %v", err)
+		}
+		err = singlerun(arv)
 		if err != nil {
 			log.Fatalf("singlerun: %v", err)
 		}
@@ -50,7 +54,11 @@ func main() {
 		waitTime := time.Minute * time.Duration(minutesBetweenRuns)
 		for {
 			log.Println("Beginning Run")
-			err := singlerun(makeArvadosClient())
+			arv, err := makeArvadosClient()
+			if err != nil {
+				log.Fatalf("makeArvadosClient: %v", err)
+			}
+			err = singlerun(arv)
 			if err != nil {
 				log.Printf("singlerun: %v", err)
 			}
@@ -60,12 +68,8 @@ func main() {
 	}
 }
 
-func makeArvadosClient() arvadosclient.ArvadosClient {
-	arv, err := arvadosclient.MakeArvadosClient()
-	if err != nil {
-		log.Fatalf("Error setting up arvados client: %s", err)
-	}
-	return arv
+func makeArvadosClient() (arvadosclient.ArvadosClient, error) {
+	return arvadosclient.MakeArvadosClient()
 }
 
 func singlerun(arv arvadosclient.ArvadosClient) error {
diff --git a/services/datamanager/datamanager_test.go b/services/datamanager/datamanager_test.go
index c2cb762..6ceb1e6 100644
--- a/services/datamanager/datamanager_test.go
+++ b/services/datamanager/datamanager_test.go
@@ -33,7 +33,11 @@ func SetupDataManagerTest(t *testing.T) {
 	arvadostest.StartAPI()
 	arvadostest.StartKeep(2, false)
 
-	arv = makeArvadosClient()
+	var err error
+	arv, err = makeArvadosClient()
+	if err != nil {
+		t.Fatalf("Error making arvados client: %s", err)
+	}
 
 	// keep client
 	keepClient = &keepclient.KeepClient{
@@ -44,7 +48,7 @@ func SetupDataManagerTest(t *testing.T) {
 	}
 
 	// discover keep services
-	if err := keepClient.DiscoverKeepServers(); err != nil {
+	if err = keepClient.DiscoverKeepServers(); err != nil {
 		t.Fatalf("Error discovering keep services: %s", err)
 	}
 	keepServers = []string{}

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list