[ARVADOS] updated: f457c4706c3293940eda4b38467c0abb23d64697

Git user git at public.curoverse.com
Tue Jun 14 10:25:06 EDT 2016


Summary of changes:
 services/crunch-run/crunchrun.go      | 22 +++++-----------------
 services/crunch-run/crunchrun_test.go |  6 +++---
 2 files changed, 8 insertions(+), 20 deletions(-)

  discards  8a72ac3af48377da476ede91c5041c23595e4a25 (commit)
  discards  1a2ef413537bf485e94f1308253a38bc442b0615 (commit)
       via  f457c4706c3293940eda4b38467c0abb23d64697 (commit)
       via  3d811b90bfdabc882eb6640c9acae15688d8c4d2 (commit)
       via  469b601437fa0b44c4453a169197970e8f0b3b99 (commit)

This update added new revisions after undoing existing revisions.  That is
to say, the old revision is not a strict subset of the new revision.  This
situation occurs when you --force push a change and generate a repository
containing something like this:

 * -- * -- B -- O -- O -- O (8a72ac3af48377da476ede91c5041c23595e4a25)
            \
             N -- N -- N (f457c4706c3293940eda4b38467c0abb23d64697)

When this happens we assume that you've already had alert emails for all
of the O revisions, and so we here report only the revisions in the N
branch from the common base, B.

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 f457c4706c3293940eda4b38467c0abb23d64697
Author: Tom Clegg <tom at curoverse.com>
Date:   Tue Jun 14 10:24:21 2016 -0400

    9374: Use arvados.Collection instead of own CollectionRecord.

diff --git a/services/crunch-run/crunchrun.go b/services/crunch-run/crunchrun.go
index e9206fd..c0df527 100644
--- a/services/crunch-run/crunchrun.go
+++ b/services/crunch-run/crunchrun.go
@@ -40,12 +40,6 @@ type IKeepClient interface {
 	ManifestFileReader(m manifest.Manifest, filename string) (keepclient.ReadCloserWithLen, error)
 }
 
-// Collection record returned by the API server.
-type CollectionRecord struct {
-	ManifestText     string `json:"manifest_text"`
-	PortableDataHash string `json:"portable_data_hash"`
-}
-
 // NewLogWriter is a factory function to create a new log writer.
 type NewLogWriter func(name string) io.WriteCloser
 
@@ -128,7 +122,7 @@ func (runner *ContainerRunner) LoadImage() (err error) {
 
 	runner.CrunchLog.Printf("Fetching Docker image from collection '%s'", runner.Container.ContainerImage)
 
-	var collection CollectionRecord
+	var collection arvados.Collection
 	err = runner.ArvClient.Get("collections", runner.Container.ContainerImage, nil, &collection)
 	if err != nil {
 		return fmt.Errorf("While getting container image collection: %v", err)
@@ -526,7 +520,7 @@ func (runner *ContainerRunner) CaptureOutput() error {
 		}
 		defer file.Close()
 
-		rec := CollectionRecord{}
+		var rec arvados.Collection
 		err = json.NewDecoder(file).Decode(&rec)
 		if err != nil {
 			return fmt.Errorf("While reading FUSE metafile: %v", err)
@@ -534,7 +528,7 @@ func (runner *ContainerRunner) CaptureOutput() error {
 		manifestText = rec.ManifestText
 	}
 
-	var response CollectionRecord
+	var response arvados.Collection
 	err = runner.ArvClient.Create("collections",
 		arvadosclient.Dict{
 			"collection": arvadosclient.Dict{
@@ -598,7 +592,7 @@ func (runner *ContainerRunner) CommitLogs() error {
 		return fmt.Errorf("While creating log manifest: %v", err)
 	}
 
-	var response CollectionRecord
+	var response arvados.Collection
 	err = runner.ArvClient.Create("collections",
 		arvadosclient.Dict{
 			"collection": arvadosclient.Dict{
diff --git a/services/crunch-run/crunchrun_test.go b/services/crunch-run/crunchrun_test.go
index 242e207..dd9d0a1 100644
--- a/services/crunch-run/crunchrun_test.go
+++ b/services/crunch-run/crunchrun_test.go
@@ -155,7 +155,7 @@ func (this *ArvTestClient) Create(resourceType string,
 
 	if resourceType == "collections" && output != nil {
 		mt := parameters["collection"].(arvadosclient.Dict)["manifest_text"].(string)
-		outmap := output.(*CollectionRecord)
+		outmap := output.(*arvados.Collection)
 		outmap.PortableDataHash = fmt.Sprintf("%x+%d", md5.Sum([]byte(mt)), len(mt))
 	}
 
@@ -178,9 +178,9 @@ func (this *ArvTestClient) Call(method, resourceType, uuid, action string, param
 func (this *ArvTestClient) Get(resourceType string, uuid string, parameters arvadosclient.Dict, output interface{}) error {
 	if resourceType == "collections" {
 		if uuid == hwPDH {
-			output.(*CollectionRecord).ManifestText = hwManifest
+			output.(*arvados.Collection).ManifestText = hwManifest
 		} else if uuid == otherPDH {
-			output.(*CollectionRecord).ManifestText = otherManifest
+			output.(*arvados.Collection).ManifestText = otherManifest
 		}
 	}
 	if resourceType == "containers" {

commit 3d811b90bfdabc882eb6640c9acae15688d8c4d2
Author: Tom Clegg <tom at curoverse.com>
Date:   Mon Jun 13 15:03:50 2016 -0400

    9374: Propagate API transaction error details from response body to caller.

diff --git a/sdk/go/arvados/client.go b/sdk/go/arvados/client.go
index ee830c8..ee7db23 100644
--- a/sdk/go/arvados/client.go
+++ b/sdk/go/arvados/client.go
@@ -3,7 +3,6 @@ package arvados
 import (
 	"crypto/tls"
 	"encoding/json"
-	"fmt"
 	"io"
 	"io/ioutil"
 	"net/http"
@@ -73,7 +72,7 @@ func (c *Client) DoAndDecode(dst interface{}, req *http.Request) error {
 		return err
 	}
 	if resp.StatusCode != 200 {
-		return fmt.Errorf("request failed (%s): %s", req.URL, resp.Status)
+		return newTransactionError(req, resp, buf)
 	}
 	if dst == nil {
 		return nil
diff --git a/sdk/go/arvados/error.go b/sdk/go/arvados/error.go
new file mode 100644
index 0000000..4b24e6f
--- /dev/null
+++ b/sdk/go/arvados/error.go
@@ -0,0 +1,43 @@
+package arvados
+
+import (
+	"encoding/json"
+	"fmt"
+	"net/http"
+	"net/url"
+	"strings"
+)
+
+type TransactionError struct {
+	Method     string
+	URL        url.URL
+	StatusCode int
+	Status     string
+	errors     []string
+}
+
+func (e TransactionError) Error() (s string) {
+	s = fmt.Sprintf("request failed: %s", e.URL)
+	if e.Status != "" {
+		s = s + ": " + e.Status
+	}
+	if len(e.errors) > 0 {
+		s = s + ": " + strings.Join(e.errors, "; ")
+	}
+	return
+}
+
+func newTransactionError(req *http.Request, resp *http.Response, buf []byte) *TransactionError {
+	var e TransactionError
+	if json.Unmarshal(buf, &e) != nil {
+		// No JSON-formatted error response
+		e.errors = nil
+	}
+	e.Method = req.Method
+	e.URL = *req.URL
+	if resp != nil {
+		e.Status = resp.Status
+		e.StatusCode = resp.StatusCode
+	}
+	return &e
+}

commit 469b601437fa0b44c4453a169197970e8f0b3b99
Author: Tom Clegg <tom at curoverse.com>
Date:   Thu Jun 9 23:18:24 2016 -0400

    9374: Add arvados.APIClientAuthorization.

diff --git a/sdk/go/arvados/api_client_authorization.go b/sdk/go/arvados/api_client_authorization.go
new file mode 100644
index 0000000..b7f9db6
--- /dev/null
+++ b/sdk/go/arvados/api_client_authorization.go
@@ -0,0 +1,12 @@
+package arvados
+
+// APIClientAuthorization is an arvados#apiClientAuthorization resource.
+type APIClientAuthorization struct {
+	UUID     string `json:"uuid"`
+	APIToken string `json:"api_token"`
+}
+
+// APIClientAuthorizationList is an arvados#apiClientAuthorizationList resource.
+type APIClientAuthorizationList struct {
+	Items []APIClientAuthorization `json:"items"`
+}
diff --git a/sdk/go/dispatch/dispatch.go b/sdk/go/dispatch/dispatch.go
index 4b66c23..ce536de 100644
--- a/sdk/go/dispatch/dispatch.go
+++ b/sdk/go/dispatch/dispatch.go
@@ -22,15 +22,6 @@ const (
 	Cancelled = arvados.ContainerStateCancelled
 )
 
-type apiClientAuthorization struct {
-	UUID     string `json:"uuid"`
-	APIToken string `json:"api_token"`
-}
-
-type apiClientAuthorizationList struct {
-	Items []apiClientAuthorization `json:"items"`
-}
-
 // Dispatcher holds the state of the dispatcher
 type Dispatcher struct {
 	// The Arvados client
@@ -58,7 +49,7 @@ type Dispatcher struct {
 
 	mineMutex  sync.Mutex
 	mineMap    map[string]chan arvados.Container
-	Auth       apiClientAuthorization
+	Auth       arvados.APIClientAuthorization
 	containers chan arvados.Container
 }
 
diff --git a/services/crunch-run/crunchrun.go b/services/crunch-run/crunchrun.go
index 758f41e..e9206fd 100644
--- a/services/crunch-run/crunchrun.go
+++ b/services/crunch-run/crunchrun.go
@@ -46,12 +46,6 @@ type CollectionRecord struct {
 	PortableDataHash string `json:"portable_data_hash"`
 }
 
-// APIClientAuthorization is an arvados#api_client_authorization resource.
-type APIClientAuthorization struct {
-	UUID     string `json:"uuid"`
-	APIToken string `json:"api_token"`
-}
-
 // NewLogWriter is a factory function to create a new log writer.
 type NewLogWriter func(name string) io.WriteCloser
 
@@ -638,7 +632,7 @@ func (runner *ContainerRunner) ContainerToken() (string, error) {
 		return runner.token, nil
 	}
 
-	var auth APIClientAuthorization
+	var auth arvados.APIClientAuthorization
 	err := runner.ArvClient.Call("GET", "containers", runner.Container.UUID, "auth", nil, &auth)
 	if err != nil {
 		return "", err

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list