[ARVADOS] updated: 1.1.1-51-g15eda57

Git user git at public.curoverse.com
Thu Nov 30 10:55:32 EST 2017


Summary of changes:
 .gitignore                                         |   1 +
 apps/workbench/app/models/arvados_api_client.rb    |   4 +-
 apps/workbench/app/models/user.rb                  |   2 +-
 doc/_config.yml                                    |   1 +
 doc/user/cwl/cwl-run-options.html.textile.liquid   |   2 +-
 .../topics/arv-sync-groups.html.textile.liquid     |  53 +++++++++++++++
 sdk/R/.RData                                       | Bin 54456 -> 94018 bytes
 sdk/R/R/Arvados.R                                  |  10 ++-
 sdk/R/R/HttpParser.R                               |   4 --
 sdk/R/R/HttpRequest.R                              |  55 +++++++++++++---
 services/crunch-run/crunchrun.go                   |  59 +++++++++++++----
 services/crunch-run/crunchrun_test.go              |  72 ++++++++++++++++++++-
 12 files changed, 230 insertions(+), 33 deletions(-)
 create mode 100644 doc/user/topics/arv-sync-groups.html.textile.liquid

       via  15eda5715c312d12ec24c24db80448bee90e38ea (commit)
       via  fbb9221d9de4c4a27e0c8aefc48c7c9c7a80ceab (commit)
       via  0829e2dd44673c6194ba076e2d89db3c9b57e0b8 (commit)
       via  5b2ebfe3b248790efbce3206b693dd93f369ea4e (commit)
       via  4ad171b5486ab8874ffaf9721891c2961fd7c9b2 (commit)
       via  a3fac0331ea84ff54b4a01698af5be5ad350a7fe (commit)
       via  1f927c19945fcdf02be92272cab888d512cb0a37 (commit)
       via  fbcedc4041edae0c1ff5367915bb75d60d47a99f (commit)
       via  35035ce1c0e71990a30f6b1cc2aad961d06774cd (commit)
       via  a7bbcabfeb74bd61ca92078a0a49caeab01e08bc (commit)
       via  ce911bd75fb998c2ac1d88a67db55f7f0e362752 (commit)
       via  84bc109580e503b4b8bbb5ddcd5f1d909745141f (commit)
       via  3d0daf1adcbdf863ae59ea5bb154c216c46b356a (commit)
       via  53a6cafcdc13c0b8ed60f1a2912d660f2e5b415d (commit)
       via  4b16a16d0de04504f0172ce391da1fa603eb653c (commit)
      from  29659ffa9e00efe7a845aa303c70ba543c23174d (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 15eda5715c312d12ec24c24db80448bee90e38ea
Merge: fbb9221 0829e2d
Author: Fuad Muhic <fmuhic at capeannenterprises.com>
Date:   Thu Nov 30 16:55:00 2017 +0100

    Merge branch 'master' of git.curoverse.com:arvados into 11876-r-sdk
    Arvados-DCO-1.1-Signed-off-by: Fuad Muhic <fmuhic at capeannenterprises.com>


commit fbb9221d9de4c4a27e0c8aefc48c7c9c7a80ceab
Author: Fuad Muhic <fmuhic at capeannenterprises.com>
Date:   Thu Nov 30 16:53:12 2017 +0100

    Improved HTTP request filtering and response error handling.
    Arvados-DCO-1.1-Signed-off-by: Fuad Muhic <fmuhic at capeannenterprises.com>

diff --git a/.gitignore b/.gitignore
index 0e876bb..cbebe67 100644
--- a/.gitignore
+++ b/.gitignore
@@ -28,3 +28,4 @@ services/api/config/arvados-clients.yml
 *#*
 .DS_Store
 .vscode
+.Rproj.user
diff --git a/sdk/R/.RData b/sdk/R/.RData
index 167f8c3..13255a2 100644
Binary files a/sdk/R/.RData and b/sdk/R/.RData differ
diff --git a/sdk/R/R/Arvados.R b/sdk/R/R/Arvados.R
index b44e105..204d87e 100644
--- a/sdk/R/R/Arvados.R
+++ b/sdk/R/R/Arvados.R
@@ -44,6 +44,10 @@ Arvados$methods(
 
         httpParser <- HttpParser()
         collection <- httpParser$parseCollectionGet(server_response)
+
+        if(!is.null(collection$errors))
+            stop(collection$errors)       
+
         class(collection) <- "ArvadosCollection"
 
         return(collection)
@@ -62,11 +66,15 @@ Arvados$methods(
     {
         #Todo(Fudo): Implement limit and offset
         collection_relative_url <- "collections"
-        http_request <- HttpRequest("GET", token, host, collection_relative_url, filters) 
+        http_request <- HttpRequest("GET", token, host, collection_relative_url, filters, limit, offset) 
         server_response <- http_request$execute()
 
         httpParser <- HttpParser()
         collection <- httpParser$parseCollectionGet(server_response)
+
+        if(!is.null(collection$errors))
+            stop(collection$errors)       
+
         class(collection) <- "ArvadosCollectionList"
 
         return(collection)
diff --git a/sdk/R/R/HttpParser.R b/sdk/R/R/HttpParser.R
index c685fb5..09304fc 100644
--- a/sdk/R/R/HttpParser.R
+++ b/sdk/R/R/HttpParser.R
@@ -14,10 +14,6 @@ HttpParser <- setRefClass(
 
         parseCollectionGet = function(server_response) 
         {
-            #Todo(Fudo): Implement proper server code checking
-            #if(server_response$response_code != 200)
-                #stop("Error");
-
             parsed_response <- httr::content(server_response, as = "parsed", type = "application/json")
 
             #Todo(Fudo): Create new Collection object and populate it
diff --git a/sdk/R/R/HttpRequest.R b/sdk/R/R/HttpRequest.R
index 3076eed..96f0a83 100644
--- a/sdk/R/R/HttpRequest.R
+++ b/sdk/R/R/HttpRequest.R
@@ -87,28 +87,67 @@ HttpRequest <- setRefClass(
 
         generateQuery = function() 
         {
-            finalQuery <- ""
+            #Todo(Fudo): This function is a mess, refactor it
+            finalQuery <- "?alt=json"
 
             if(!is.null(query_filters))
             {
                 filters <- sapply(query_filters, function(filter)
                 {
-                    filter <- sapply(filter, function(component) 
-                    {
+                    if(length(filter) != 3)
+                        stop("Filter list must have exacthey 3 elements.")
+
+                    attributeAndOperator = filter[c(1, 2)]
+                    filterList = filter[[3]]
+                    filterListIsPrimitive = TRUE
+                    if(length(filterList) > 1)
+                        filterListIsPrimitive = FALSE
+
+                    attributeAndOperator <- sapply(attributeAndOperator, function(component) {
                         component <- paste0("\"", component, "\"")
                     })
-                    
+
+                    filterList <- sapply(unlist(filterList), function(filter) {
+                        filter <- paste0("\"", filter, "\"")
+                    })
+
+                    filterList <- paste(filterList, collapse = ",+")
+
+                    if(!filterListIsPrimitive)
+                        filterList <- paste0("[", filterList, "]")
+
+                    filter <- c(attributeAndOperator, filterList)
+
                     queryParameter <- paste(filter, collapse = ",+")
-                    queryParameter <- paste0("[[", queryParameter, "]]")
+                    queryParameter <- paste0("[", queryParameter, "]")
+        
                 })
 
+                filters <- paste(filters, collapse = ",+")
+                filters <- paste0("[", filters, "]")
+
                 encodedQuery <- URLencode(filters, reserved = T, repeated = T)
 
-                #Todo(Fudo): Hardcoded for now. Look for a better solution.
-                finalQuery <- paste0("?alt=json&filters=", encodedQuery)
+                finalQuery <- paste0(finalQuery, "&filters=", encodedQuery)
 
                 #Todo(Fudo): This is a hack for now. Find a proper solution.
-                finalQuery <- str_replace_all(finalQuery, "%2B", "+")
+                finalQuery <- stringr::str_replace_all(finalQuery, "%2B", "+")
+            }
+
+            if(!is.null(response_limit))
+            {
+                if(!is.numeric(response_limit))
+                    stop("Limit must be a numeric type.")
+                
+                finalQuery <- paste0(finalQuery, "&limit=", response_limit)
+            }
+
+            if(!is.null(query_offset))
+            {
+                if(!is.numeric(query_offset))
+                    stop("Offset must be a numeric type.")
+                
+                finalQuery <- paste0(finalQuery, "&offset=", query_offset)
             }
 
             finalQuery

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list