[ARVADOS] updated: 1.1.2-208-g59eb205
Git user
git at public.curoverse.com
Thu Jan 25 09:15:19 EST 2018
Summary of changes:
sdk/R/R/ArvadosFile.R | 7 +-
sdk/R/R/HttpRequest.R | 2 +-
sdk/R/R/RESTService.R | 14 ++
sdk/R/tests/testthat/fakes/FakeRESTService.R | 8 +
sdk/R/tests/testthat/test-ArvadosFile.R | 13 +-
.../crunch-dispatch-slurm/crunch-dispatch-slurm.go | 91 +++-------
.../crunch-dispatch-slurm_test.go | 195 ++++++++-------------
services/crunch-dispatch-slurm/slurm.go | 73 ++++++++
services/crunch-dispatch-slurm/squeue.go | 9 +-
services/crunch-run/crunchrun.go | 133 ++++----------
services/crunch-run/crunchrun_test.go | 143 ++++++++-------
11 files changed, 310 insertions(+), 378 deletions(-)
create mode 100644 services/crunch-dispatch-slurm/slurm.go
via 59eb2058e7111581645c960ba868f49f0fed152b (commit)
via 78de557466248e1a193e07ae1945b29a23fc56a8 (commit)
via b50ea3465244e66ecf2a852f598f5b576e705017 (commit)
via e6fa5ac95cff84a7b00dd8ab32349d88473400da (commit)
via e8de8d362df44459ecbdff44ed27a12b7652762c (commit)
via 03ee5e57fab4ec34b5830e8a93d329a084adf42c (commit)
via 8758f3ddc81b9ef9aaab111eb331e452c4ec7de5 (commit)
via a63829d71b904ead17aeac3c68bf01e9b020a3a1 (commit)
via bb72c328306667a0429c10caa90a79b2b9ff0bd6 (commit)
via 2edd084814bd450c0bfb14915bb9bc3ce96498eb (commit)
via 3194c1b24ffe6fff5fcb2f620ca6ee43741e3462 (commit)
via d14421423f2bd72b2c3eb95bdebe85a210972a12 (commit)
via 31007a99c336423f2b34a306028ec0aa41b1dd3a (commit)
from 3a6a89199e2478454905731ccef0868d5fdd6f8f (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 59eb2058e7111581645c960ba868f49f0fed152b
Merge: 78de557 b50ea34
Author: Fuad Muhic <fmuhic at capeannenterprises.com>
Date: Thu Jan 25 15:15:04 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 78de557466248e1a193e07ae1945b29a23fc56a8
Author: Fuad Muhic <fmuhic at capeannenterprises.com>
Date: Thu Jan 25 15:12:42 2018 +0100
ArvadosFile's connection method now returns curl connection instead of
textConnection when called with 'r' parameter
Arvados-DCO-1.1-Signed-off-by: Fuad Muhic <fmuhic at capeannenterprises.com>
diff --git a/sdk/R/R/ArvadosFile.R b/sdk/R/R/ArvadosFile.R
index 8ca818b..ffb9a6b 100644
--- a/sdk/R/R/ArvadosFile.R
+++ b/sdk/R/R/ArvadosFile.R
@@ -92,9 +92,12 @@ ArvadosFile <- R6::R6Class(
connection = function(rw)
{
- if (rw == "r")
+ if (rw == "r" || rw == "rb")
{
- return(textConnection(self$read("text")))
+ REST <- private$collection$getRESTService()
+ return(REST$getConnection(private$collection$uuid,
+ self$getRelativePath(),
+ rw))
}
else if (rw == "w")
{
diff --git a/sdk/R/R/HttpRequest.R b/sdk/R/R/HttpRequest.R
index ebfb0c6..ec364e5 100644
--- a/sdk/R/R/HttpRequest.R
+++ b/sdk/R/R/HttpRequest.R
@@ -58,7 +58,7 @@ HttpRequest <- R6::R6Class(
curl::handle_setopt(h, customrequest = "PROPFIND")
curl::handle_setheaders(h, .list = headers)
- propfindResponse <- curl::curl_fetch_memory(url, h)
+ propfindResponse <- curl::curl_fetch_memory(url, h)
},
MOVE = function(url, headers = NULL)
diff --git a/sdk/R/R/RESTService.R b/sdk/R/R/RESTService.R
index c4790ae..65c5302 100644
--- a/sdk/R/R/RESTService.R
+++ b/sdk/R/R/RESTService.R
@@ -279,6 +279,20 @@ RESTService <- R6::R6Class(
stop(paste("Server code:", serverResponse$status_code))
self$httpParser$parseResponse(serverResponse, "text")
+ },
+
+ getConnection = function(uuid, relativePath, openMode)
+ {
+ fileURL <- paste0(self$getWebDavHostName(),
+ "c=", uuid, "/", relativePath);
+ headers <- list(Authorization = paste("OAuth2", self$token))
+
+ h <- curl::new_handle()
+ curl::handle_setheaders(h, .list = headers)
+
+ conn <- curl::curl(url = fileURL, open = openMode, handle = h)
+
+ conn
}
),
diff --git a/sdk/R/tests/testthat/fakes/FakeRESTService.R b/sdk/R/tests/testthat/fakes/FakeRESTService.R
index 9c7203f..d370e87 100644
--- a/sdk/R/tests/testthat/fakes/FakeRESTService.R
+++ b/sdk/R/tests/testthat/fakes/FakeRESTService.R
@@ -18,6 +18,7 @@ FakeRESTService <- R6::R6Class(
getResourceSizeCallCount = NULL,
readCallCount = NULL,
writeCallCount = NULL,
+ getConnectionCallCount = NULL,
writeBuffer = NULL,
filtersAreConfiguredCorrectly = NULL,
bodyIsConfiguredCorrectly = NULL,
@@ -43,6 +44,7 @@ FakeRESTService <- R6::R6Class(
self$getResourceSizeCallCount <- 0
self$readCallCount <- 0
self$writeCallCount <- 0
+ self$getConnectionCallCount <- 0
self$filtersAreConfiguredCorrectly <- FALSE
self$bodyIsConfiguredCorrectly <- FALSE
@@ -152,6 +154,12 @@ FakeRESTService <- R6::R6Class(
self$writeBuffer <- content
self$writeCallCount <- self$writeCallCount + 1
self$returnContent
+ },
+
+ getConnection = function(relativePath, uuid, openMode)
+ {
+ self$getConnectionCallCount <- self$getConnectionCallCount + 1
+ self$returnContent
}
),
diff --git a/sdk/R/tests/testthat/test-ArvadosFile.R b/sdk/R/tests/testthat/test-ArvadosFile.R
index 4897056..43c841b 100644
--- a/sdk/R/tests/testthat/test-ArvadosFile.R
+++ b/sdk/R/tests/testthat/test-ArvadosFile.R
@@ -106,12 +106,12 @@ test_that("read delegates reading operation to REST service class", {
expect_that(fakeREST$readCallCount, equals(1))
})
-test_that(paste("connect returns textConnection opened",
- "in read mode when 'r' is passed as argument"), {
+test_that(paste("connection delegates connection creation ro RESTService class",
+ "which returns curl connection opened in read mode when",
+ "'r' of 'rb' is passed as argument"), {
collectionContent <- c("animal", "animal/fish")
- readContent <- "file content"
- fakeREST <- FakeRESTService$new(collectionContent, readContent)
+ fakeREST <- FakeRESTService$new(collectionContent)
api <- Arvados$new("myToken", "myHostName")
api$setRESTService(fakeREST)
@@ -120,13 +120,12 @@ test_that(paste("connect returns textConnection opened",
connection <- fish$connection("r")
- expect_that(readLines(connection), equals("file content"))
+ expect_that(fakeREST$getConnectionCallCount, equals(1))
})
-test_that(paste("connect returns textConnection opened",
+test_that(paste("connection returns textConnection opened",
"in write mode when 'w' is passed as argument"), {
-
collectionContent <- c("animal", "animal/fish")
fakeREST <- FakeRESTService$new(collectionContent)
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list