This repository has been archived by the owner on Oct 12, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Added install R * Added devtools build * devtools build and test * Clean up rscript * Added line breaks * Added devtools('.') * Added testthat package * Added roxygen * Replaced rscript * Test live * Added environment variables to test * Fixed test * Removed * Fixed tests * makeClusters to makeCluster * Error handling to stop exit * Added params to setup function * Removed pool names * Get / Get Cluster List * Added utility R source * Fixed tests * Fixed remove error handling with combine test * Forgot \ lines
- Loading branch information
Showing
13 changed files
with
178 additions
and
123 deletions.
There are no files selected for viewing
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#!/bin/bash | ||
sudo echo "deb http://cran.rstudio.com/bin/linux/ubuntu trusty/" | sudo tee -a /etc/apt/sources.list | ||
|
||
gpg --keyserver keyserver.ubuntu.com --recv-key E084DAB9 | ||
gpg -a --export E084DAB9 | sudo apt-key add - | ||
|
||
sudo apt-get update | ||
sudo apt-get install -y r-base r-base-dev libcurl4-openssl-dev | ||
sudo apt-get install -y libssl-dev libxml2-dev libgdal-dev libproj-dev libgsl-dev | ||
|
||
sudo R \ | ||
-e "Sys.setenv(BATCH_ACCOUNT_NAME = '$BATCH_ACCOUNT_NAME')" \ | ||
-e "Sys.setenv(BATCH_ACCOUNT_KEY = '$BATCH_ACCOUNT_KEY')" \ | ||
-e "Sys.setenv(BATCH_ACCOUNT_URL = '$BATCH_ACCOUNT_URL')" \ | ||
-e "Sys.setenv(STORAGE_ACCOUNT_NAME = '$STORAGE_ACCOUNT_NAME')" \ | ||
-e "Sys.setenv(STORAGE_ACCOUNT_KEY = '$STORAGE_ACCOUNT_KEY')" \ | ||
-e "getwd();" \ | ||
-e "install.packages(c('devtools', 'remotes', 'testthat', 'roxygen2'));" \ | ||
-e "devtools::install();" \ | ||
-e "devtools::build();" \ | ||
-e "res <- devtools::test(reporter='summary');" \ | ||
-e "df <- as.data.frame(res);" \ | ||
-e "if(sum(df[['failed']]) > 0 || any(df[['error']])) { q(status=1) }" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,27 @@ | ||
# Run this test for users to make sure the async cluster creation features | ||
# of doAzureParallel are still working | ||
context("async cluster scenario test") | ||
test_that("Async cluster scenario test", { | ||
testthat::skip("Live test") | ||
context("Cluster Management Test") | ||
test_that("Get Cluster List / Get Cluster test", { | ||
testthat::skip_on_travis() | ||
credentialsFileName <- "credentials.json" | ||
clusterFileName <- "cluster.json" | ||
source("utility.R") | ||
|
||
doAzureParallel::generateCredentialsConfig(credentialsFileName) | ||
doAzureParallel::generateClusterConfig(clusterFileName) | ||
settings <- getSettings() | ||
|
||
# set your credentials | ||
doAzureParallel::setCredentials(credentialsFileName) | ||
doAzureParallel::setCredentials(settings$credentials) | ||
|
||
cluster <- | ||
doAzureParallel::makeCluster(clusterSetting = clusterFileName, wait = FALSE) | ||
doAzureParallel::makeCluster(settings$clusterConfig, wait = FALSE) | ||
|
||
cluster <- getCluster(cluster$poolId) | ||
getClusterList() | ||
filter <- filter <- list() | ||
clusterList <- getClusterList() | ||
filter <- list() | ||
filter$state <- c("active", "deleting") | ||
getClusterList(filter) | ||
doAzureParallel::registerDoAzureParallel(cluster) | ||
|
||
'%dopar%' <- foreach::'%dopar%' | ||
res <- | ||
foreach::foreach(i = 1:4) %dopar% { | ||
mean(1:3) | ||
} | ||
testthat::expect_true('test-pool' %in% clusterList$Id) | ||
|
||
res | ||
clusterList <- getClusterList(filter) | ||
|
||
testthat::expect_equal(length(res), 4) | ||
testthat::expect_equal(res, list(2, 2, 2, 2)) | ||
|
||
stopCluster(cluster) | ||
for (i in 1:length(clusterList$State)) { | ||
testthat::expect_true(clusterList$State[i] == 'active' || | ||
clusterList$State[i] == 'deleting') | ||
} | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
context("foreach options test") | ||
test_that("chunksize", { | ||
testthat::skip_on_travis() | ||
source("utility.R") | ||
settings <- getSettings() | ||
|
||
# set your credentials | ||
doAzureParallel::setCredentials(settings$credentials) | ||
|
||
cluster <- doAzureParallel::makeCluster(settings$clusterConfig) | ||
doAzureParallel::registerDoAzureParallel(cluster) | ||
|
||
'%dopar%' <- foreach::'%dopar%' | ||
res <- | ||
foreach::foreach(i = 1:10, | ||
.options.azure = list(chunkSize = 3)) %dopar% { | ||
i | ||
} | ||
|
||
testthat::expect_equal(length(res), | ||
10) | ||
|
||
for (index in 1:10) { | ||
testthat::expect_equal(res[[index]], | ||
index) | ||
} | ||
|
||
res <- | ||
foreach::foreach(i = 1:2, | ||
.options.azure = list(chunkSize = 2)) %dopar% { | ||
i | ||
} | ||
|
||
testthat::expect_equal(length(res), | ||
2) | ||
|
||
for (index in 1:2) { | ||
testthat::expect_equal(res[[index]], | ||
index) | ||
} | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.