[ARVADOS] updated: 1.1.2-216-g1178add

Git user git at public.curoverse.com
Mon Jan 29 06:35:20 EST 2018


Summary of changes:
 sdk/R/NAMESPACE                                    |  5 +-
 sdk/R/R/Arvados.R                                  |  8 +++
 sdk/R/R/ArvadosFile.R                              | 18 +++++++
 sdk/R/R/Collection.R                               | 22 ++++----
 sdk/R/R/CollectionTree.R                           |  5 +-
 sdk/R/R/Subcollection.R                            | 60 ++++++++++++++++------
 sdk/R/R/util.R                                     |  2 +-
 sdk/R/README                                       |  4 +-
 sdk/R/tests/testthat/test-Collection.R             |  2 +-
 sdk/R/tests/testthat/test-HttpRequest.R            |  2 +-
 tools/arvbox/lib/arvbox/docker/Dockerfile.base     |  1 +
 tools/arvbox/lib/arvbox/docker/Dockerfile.demo     |  5 +-
 tools/arvbox/lib/arvbox/docker/crunch-setup.sh     |  9 +---
 tools/arvbox/lib/arvbox/docker/go-setup.sh         | 16 ++++++
 tools/arvbox/lib/arvbox/docker/keep-setup.sh       |  9 +---
 .../docker/service/arv-git-httpd/run-service       |  9 +---
 .../lib/arvbox/docker/service/composer/run-service | 12 ++---
 .../service/crunch-dispatch-local/run-service      | 15 +++---
 .../lib/arvbox/docker/service/keep-web/run-service |  9 +---
 .../arvbox/docker/service/keepproxy/run-service    |  9 +---
 .../arvbox/lib/arvbox/docker/service/postgres/run  |  2 +
 .../arvbox/docker/service/websockets/run-service   |  8 +--
 22 files changed, 138 insertions(+), 94 deletions(-)
 create mode 100644 tools/arvbox/lib/arvbox/docker/go-setup.sh

       via  1178add6cefa51f73dd9a229899ea906d297be5a (commit)
       via  44ab8ee44302102a7cd5289ef7336d7a94594558 (commit)
       via  5bd7108fed4a87eb7cc5a25844bb8c100977c968 (commit)
      from  7471c3fb9752482dccae508c34874f9b3c77dfb1 (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 1178add6cefa51f73dd9a229899ea906d297be5a
Merge: 44ab8ee 5bd7108
Author: Fuad Muhic <fmuhic at capeannenterprises.com>
Date:   Mon Jan 29 12:35:11 2018 +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 44ab8ee44302102a7cd5289ef7336d7a94594558
Author: Fuad Muhic <fmuhic at capeannenterprises.com>
Date:   Mon Jan 29 12:33:49 2018 +0100

    Implemented custom print functions for all public classes
    
    Arvados-DCO-1.1-Signed-off-by: Fuad Muhic <fmuhic at capeannenterprises.com>

diff --git a/sdk/R/NAMESPACE b/sdk/R/NAMESPACE
index 1c94e71..d4c143c 100644
--- a/sdk/R/NAMESPACE
+++ b/sdk/R/NAMESPACE
@@ -3,5 +3,8 @@
 export(Arvados)
 export(ArvadosFile)
 export(Collection)
-export(CollectionTree)
 export(Subcollection)
+export(print.Arvados)
+export(print.ArvadosFile)
+export(print.Collection)
+export(print.Subcollection)
diff --git a/sdk/R/R/Arvados.R b/sdk/R/R/Arvados.R
index 18b42f6..b21c604 100644
--- a/sdk/R/R/Arvados.R
+++ b/sdk/R/R/Arvados.R
@@ -165,3 +165,11 @@ Arvados <- R6::R6Class(
 
     cloneable = FALSE
 )
+
+#' @export print.Arvados
+print.Arvados = function(arvados)
+{
+    cat(paste0("Type:  ", "\"", "Arvados", "\""), sep = "\n")
+    cat(paste0("Host:  ", "\"", arvados$getHostName(), "\""), sep = "\n")
+    cat(paste0("Token: ", "\"", arvados$getToken(), "\"") , sep = "\n")
+}
diff --git a/sdk/R/R/ArvadosFile.R b/sdk/R/R/ArvadosFile.R
index ffb9a6b..7ffcb29 100644
--- a/sdk/R/R/ArvadosFile.R
+++ b/sdk/R/R/ArvadosFile.R
@@ -202,3 +202,21 @@ ArvadosFile <- R6::R6Class(
 
     cloneable = FALSE
 )
+
+#' @export print.ArvadosFile
+print.ArvadosFile = function(arvadosFile)
+{
+    collection   <- NULL
+    relativePath <- arvadosFile$getRelativePath()
+
+    if(!is.null(arvadosFile$getCollection()))
+    {
+        collection <- arvadosFile$getCollection()$uuid
+        relativePath <- paste0("/", relativePath)
+    }
+
+    cat(paste0("Type:          ", "\"", "ArvadosFile", "\""), sep = "\n")
+    cat(paste0("Name:          ", "\"", arvadosFile$getName(), "\""), sep = "\n")
+    cat(paste0("Relative path: ", "\"", relativePath, "\"") , sep = "\n")
+    cat(paste0("Collection:    ", "\"", collection, "\""), sep = "\n")
+}
diff --git a/sdk/R/R/Collection.R b/sdk/R/R/Collection.R
index 8d49cd0..2107620 100644
--- a/sdk/R/R/Collection.R
+++ b/sdk/R/R/Collection.R
@@ -50,7 +50,6 @@ Collection <- R6::R6Class(
                "Subcollection" %in% class(content))
             {
                 subcollection$add(content)
-
                 content
             }
             else
@@ -137,7 +136,7 @@ Collection <- R6::R6Class(
             elementToMove <- self$get(content)
 
             if(is.null(elementToMove))
-                stop("Element you want to move doesn't exist in the collection.")
+                stop("Content you want to move doesn't exist in the collection.")
 
             elementToMove$move(newLocation)
         },
@@ -161,18 +160,15 @@ Collection <- R6::R6Class(
 
         REST        = NULL,
         tree        = NULL,
-        fileContent = NULL,
-
-        generateTree = function(content)
-        {
-            treeBranches <- sapply(collectionContent, function(filePath)
-            {
-                splitPath <- unlist(strsplit(filePath$name, "/", fixed = TRUE))
-
-                branch = private$createBranch(splitPath, filePath$fileSize)      
-            })
-        }
+        fileContent = NULL
     ),
 
     cloneable = FALSE
 )
+
+#' @export print.Collection
+print.Collection = function(collection)
+{
+    cat(paste0("Type: ", "\"", "Arvados Collection", "\""), sep = "\n")
+    cat(paste0("uuid: ", "\"", collection$uuid, "\""), sep = "\n")
+}
diff --git a/sdk/R/R/CollectionTree.R b/sdk/R/R/CollectionTree.R
index fcc5dbe..4194be9 100644
--- a/sdk/R/R/CollectionTree.R
+++ b/sdk/R/R/CollectionTree.R
@@ -7,7 +7,6 @@ source("./R/util.R")
 #' Update description
 #'
 #' @examples arv = Collection$new(api, uuid)
-#' @export CollectionTree
 CollectionTree <- R6::R6Class(
     "CollectionTree",
     public = list(
@@ -96,8 +95,8 @@ CollectionTree <- R6::R6Class(
             }
             else
             {
-                # Note: REST always returns folder name alone before other folder content
-                # (for some reason), so in first iteration we don't know if it's a file
+                # Note: REST always returns folder name alone before other folder 
+                # content, so in first iteration we don't know if it's a file
                 # or folder since its just a name, so we assume it's a file. 
                 # If we encounter that same name again we know 
                 # it's a folder so we need to replace ArvadosFile with Subcollection.
diff --git a/sdk/R/R/Subcollection.R b/sdk/R/R/Subcollection.R
index a1f83f5..7eb4381 100644
--- a/sdk/R/R/Subcollection.R
+++ b/sdk/R/R/Subcollection.R
@@ -13,7 +13,7 @@ Subcollection <- R6::R6Class(
 
         initialize = function(name)
         {
-            private$name       <- name
+            private$name <- name
         },
 
         getName = function() private$name,
@@ -101,21 +101,7 @@ Subcollection <- R6::R6Class(
 
         getFileListing = function(fullPath = TRUE)
         {
-            content <- NULL
-
-            if(fullPath)
-            {
-                for(child in private$children)
-                    content <- c(content, child$getFileListing())
-
-                if(private$name != "")
-                    content <- unlist(paste0(private$name, "/", content))
-            }
-            else
-            {
-                for(child in private$children)
-                    content <- c(content, child$getName())
-            }
+            content <- private$getContentAsCharVector(fullPath)
 
             content[order(tolower(content))]
         },
@@ -250,8 +236,50 @@ Subcollection <- R6::R6Class(
             parent$remove(private$name)
 
             parent$setCollection(parentsCollection, setRecursively = FALSE)
+        },
+
+        getContentAsCharVector = function(fullPath = TRUE)
+        {
+            content <- NULL
+
+            if(fullPath)
+            {
+                for(child in private$children)
+                    content <- c(content, child$getFileListing())
+
+                if(private$name != "")
+                    content <- unlist(paste0(private$name, "/", content))
+            }
+            else
+            {
+                for(child in private$children)
+                    content <- c(content, child$getName())
+            }
+
+            content
+
         }
     ),
     
     cloneable = FALSE
 )
+
+#' @export print.Subcollection
+print.Subcollection = function(subCollection)
+{
+    collection   <- NULL
+    relativePath <- subCollection$getRelativePath()
+
+    if(!is.null(subCollection$getCollection()))
+    {
+        collection <- subCollection$getCollection()$uuid
+
+        if(!subCollection$getName() == "")
+            relativePath <- paste0("/", relativePath)
+    }
+
+    cat(paste0("Type:          ", "\"", "Arvados Subcollection", "\""), sep = "\n")
+    cat(paste0("Name:          ", "\"", subCollection$getName(), "\""), sep = "\n")
+    cat(paste0("Relative path: ", "\"", relativePath, "\"") , sep = "\n")
+    cat(paste0("Collection:    ", "\"", collection, "\""), sep = "\n")
+}
diff --git a/sdk/R/R/util.R b/sdk/R/R/util.R
index 65b5a4e..d9af8b0 100644
--- a/sdk/R/R/util.R
+++ b/sdk/R/R/util.R
@@ -49,6 +49,6 @@ splitToPathAndName = function(path)
     nameAndPath$name <- components[length(components)]
     nameAndPath$path <- trimFromStart(paste0(components[-length(components)], collapse = "/"),
                                       "/")
-    
+
     nameAndPath
 }
diff --git a/sdk/R/README b/sdk/R/README
index 6b8cd3f..8a0c31d 100644
--- a/sdk/R/README
+++ b/sdk/R/README
@@ -57,7 +57,7 @@ deletedCollection <- arv$deleteCollection("uuid")
 
 #Update a collection's metadata:
 
-updatedCollection <- arv$updateCollection("uuid", list(name = "My new name", description = "a brand new description"))
+updatedCollection <- arv$updateCollection("uuid", list(name = "New name", description = "New description"))
 
 --------------------------------------------------------------------------------------------------------------------------------
 
@@ -189,7 +189,7 @@ file$move("newDestination/file.cpp")
 subcollection <- collection$get("location/to/folder")
 subcollection$move("newDestination/folder")
 
-#Make sure to include file name in new destination
+#Make sure to include new file name in destination
 #In second example file$move("newDestination/") will not work
 
 --------------------------------------------------------------------------------------------------------------------------------
diff --git a/sdk/R/tests/testthat/test-Collection.R b/sdk/R/tests/testthat/test-Collection.R
index 0c45958..63a402d 100644
--- a/sdk/R/tests/testthat/test-Collection.R
+++ b/sdk/R/tests/testthat/test-Collection.R
@@ -215,7 +215,7 @@ test_that("move raises exception if new location is not valid", {
     collection <- Collection$new(api, "myUUID")
 
     expect_that(collection$move("fish", "object"),
-                throws_error("Element you want to move doesn't exist in the collection.",
+                throws_error("Content you want to move doesn't exist in the collection.",
                              fixed = TRUE))
 })
 
diff --git a/sdk/R/tests/testthat/test-HttpRequest.R b/sdk/R/tests/testthat/test-HttpRequest.R
index 427ec34..e850374 100644
--- a/sdk/R/tests/testthat/test-HttpRequest.R
+++ b/sdk/R/tests/testthat/test-HttpRequest.R
@@ -1,4 +1,4 @@
-context("Http Parser")
+context("Http Request")
 
 
 test_that(paste("createQuery generates and encodes query portion of http",

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list