Skip to content
This repository has been archived by the owner on Oct 12, 2023. It is now read-only.

Commit

Permalink
Merge master to stable v0.7.1 (#287)
Browse files Browse the repository at this point in the history
* Update README.md (#164)

* remove unused validator file (#167)

* initial docs for docker users (#166)

* initial docs for docker users

* Fixes plus PR feedback

* Feature/configfromobj support programmatically created credentials and cluster configs (#168)

* support programmatically generated credentials/cluster config

* update docs for programmatically generated config

* reformat code

* styling fixes

* combine credentials cluster config methods

* fix set credentials issue and test input

* do not create az_config.json

* update messages

* move githubAuthenticationToken from cluster config to credentials

* updated docs (#172)

* Implemented progress bar with verbose details (#181)

* Implemented a more detailed verbose progress bar

* Fixed infix operator spacing

* Added newline for 'Tasks have completed' message

* Changing UI of progress bar (#183)

* Redone the progress bar

* Added string utilities

* Feature/longrunjob, long running job improvement, add deleteJob and terminateJob (#174)

* add documentation and sample for long running job

* update sample file name

* update long running job doc and test

* update metadata code

* add errorHandling to job metadata

* add deleteJob to delete both job defintion and job result

* styling fix

* save foreach wait setting to metadata

* implement retry logic in getjobresult

* add terminateJob

* handle various corner cases

* regenerate document

* add job state in getJob

* do not fail getJobResult if getMetadata failed for backward compatibility

* add deleteJob option to foreach, by default it is true for wait=TRUE job

* styling fix

* update version and changelog

* address review feedback

* add setJobAutoDelete function

* rename jobAutoDelete to autoDeleteJob to workaround R bugs and update docs

* update faq

* fix styling issues

* more styling fix

* roll back manual update to DESCRIPTION

* add namespace to api call

* Feature/docker registry auth (#182)

* initial changes to support auth

* Temp changes to pull install scripts from local branch

* Updated docs to expose dockerAuth field

* Minor tweaks to doc language

* revert change to setup scripts back to master

* fix linter line too long error

* add links to cluster configuration docs

* remove whitespace

* PR feedback

* write and read docker password from disk

* Fixed based on recent feedback (#185)

* Updated DESCRIPTION's reference rAzureBatch to v0.5.4 (#184)

* address issue where empty docker auth credentials are used to create … (#190)

* address issue where empty docker auth credentials are used to create the cluster

* remove unnecessary null check

* Collapsing pool package installation on start task command line (#191)

* Collasping the R package installations for pool installation

* Renamed script variable

* Fixed pool installation test

* Fixed length test

* Improve R console UI experience (#193)

* Improve UI experience

* Added verbose mode to deleteJob and deleteStorageContainer

* Refactor print method

* Fixed order of package installation (#196)

* Fix/add task perf (#195)

* Added task id range

* Removed upload blob methods

* Removed upload blob

* Fixed trailing whitespace

* Discarded job id on merge task id name

* Adding chunk logic for argsList

* Added check for args containing data sets

* Removed container name for docker run command for all tasks

* Added test for hasDataSet

* Fix travis yml

* Adding before_install for R

* Removed before install, added github package of nycflights13

* fix link to generate config doc (#199)

* Feature/asynccluster (#197)

* support for async cluster creation

* fix lintr bot errors

* remove test files

* use private function for duplicate code

* update change log

* Feature/asynccluster1 (#200)

* show node status in getCluster

* workaround error

* minor fixes

* add getClusterList api

* add metadata to pool indicating pool is created by doAzureParallel

* add test for getClusterList(), add 'other' state for nodes for getCluster()

* Update documentation on using private docker registries (#201)

* update documentation for private docker registry

* update docs to be less confusing

* In order correction (#202)

* Update long_running_job.R (#206)

renamed a misnamed azure options variable

* Created an issue template (#207)

* Typos in README.md (#210)

* list cluster should use paste() instead of + (#213)

* use paste() instead of +

* use paste0

* Feature/getjobresultlocal (#204)

* Get job result locally

* Get job result locally

* preserve task sequence in getjobresult

* keep task result sequence

* keep task result in sequence and as a flat list

* fix lintr error

* fix typo in error message

* delete cluster after test is done

* add retry to getJobResultLocal, resolve xml2 issue

* fix typo, lintr and missing variable

* allow local RProfile libraries to be loaded by default (#209)

* allow local session info to be loaded

* update line lengths

* Bundling worker scripts into zip (#212)

* Added zip file extraction

* Fixed cluster setup

* Added cluster script and quiet zip function

* Replaced url name with correct zip file name

* Removed startup folder name

* Added apt-get install on job prep

* Fixed branch names

* Reverted changes (#227)

* Upgraded description for fix resize cluster (#225)

* Update sample to only use the first 6 files (#228)

The file format change over the year so only use the first 6 so the sample is consistent. This also has the added benefit that the sample runs a bit faster so users can get a feel for the tooling a bit more easily.

* Added optional retry count flag (#235)

* Added job retry count flag

* Renamed maxTaskRetryCount

* Added cluster config for caret example (#237)

* Added cluster config for caret

* Reverted changes for installation

* Reverted fit model

* Changed to low priority

* Added cluster submission output (#236)

* Finish output for cluster

* Added resource files print info

* Fixed ordering

* Renamed Nodes to Scale

* Fixed typo

* Feature/nationalcloud (#239)

* support national cloud

* fix hardcoded domain name in createOutputFile

* update rAzureBatch version etc

* auto discovery of storage account endpoint suffix

* styling fix

* fix test failure

* add back endpointSuffix for storage account

* add storage account endpoint suffix to downloadBlob call

* update docs

* improve error handling for create cluster (#241)

* improve error handling for create cluster

* remove extra space

* Fixed argument validation (#244)

* Fixed incorrect variable name (#243)

* Reverted variable name (#245)

* Improvement on merge task performance (#223)

* Added doParallel support

* Renamed txt file

* Fixed lintr

* Restructured merger script

* Removed some error handling cases

* Fixed syntax

* Renamed error handling test

* Added accumulator

* Using filter on function

* Proper filtering of tasks

* Fixed merge naming

* Added error handling for worker, separate merge task function

* Added buckets

* Added addSubMergeTask

* Added merge sub task functions

* Fixing file names

* Fixed sorting order for merger

* Added space

* Merger in R

* Clean up merger worker script

* Added mergeSize option

* By default one bucket

* Removed merge size flag

* Fixed test

* Fixed lint code

* Fixed more lintr issues

* Fixed lintr

* Fixed the added comments

* Fixed the if statement

* Add list combine function validation

* Removed verification

* Fixed lintr

* Mapping of job results (#248)

* handle addjob error 403 (#251)

* Sample - Add a sample for using SAS resource files (#253)

* resubmit sas resource files example

* fixed typos and grammar

* remove unnecessary github reference

* fix sample link to sas resource files (#254)

* Feature/pkgmgmtdoc (#231)

* merge package management doc

* merge packagement docs

* address review feedback (#232)

* address review feedback

* add reference to github and bioconductor packages in worker

* update package management sample

* update package management doc (#233)

* address review feedback

* add reference to github and bioconductor packages in worker

* update package management sample

* update package management doc

* remove cluster.json

* remove package installation

* Feature/getstarted (#255)

* get started script

* add account_setup.sh

* fix typo

* fix typo

* support shared key

* fix typos

* retrieve batch/storage account keys

* fix bug

* typo

* fix if logic

* fix typo

* bug

* retrieve batch primary key

* storage list_keys

* storage keys

* storage key exceptin

* storage key

* storage key

* storage key

* storage key

* storage key

* storage key

* storage key

* storage key

* storage key\

* storage key

* storage key

* storage key

* storage key

* storage key

* storage key

* storage key

* storage key

* storage key

* storage key

* storage key

* storage key

* storage key

* storage key

* storage key

* storage key

* storage key

* storage key

* storage key

* storage key\

* storage key

* storage key

* storage key

* delete resource group

* print

* print

* print

* exit from delete rg

* delete resource group

* aad auth

* resource group name

* add docs for get started script

* update python script location

* update doc

* update doc

* update doc

* fix credential setting names

* fix credential setting names

* address review feedback

* Updated version v0.6.3 (#256)

* Enable AAD and VNet Support (#252)

* Added config property for service principal

* Fixed property names for service principal

* Added makeBatchClient and makeStorageClient functions

* Added ARM calls

* Fixed configuration

* Added more working features for AAD auth

* Switched sas token generator

* Added storage client generate sas tokens into doAzureParallel

* basic foreach loop works

* Long running jobs with AAD validated

* Removed credentials output

* Added docs for vnets

* Fixed network configurations for doazp

* Replaced rAzureBatch namespace with batchClient

* Fixed url auth for storage

* Changed cluster parameter naming

* Renamed helper file and fixed lintr

* Wrong file name

* Removed new line

* Removed lowerCamelCase for R6 classes

* Fixed sas token

* Fixed createBlobUrl

* Fixed configuration endpoint suffix

* Fixed endpoint suffix for download merge results

* Added environment parameter in setCredentials

* Added default for endpoint suffix for svp

* Changed default credentials file to shared key

* Updated docs for sharedkey/serviceprincipal

* Updated documentation

* Broken test for doc example

* Fixed lintr for docs

* Updated version to 0.7.0

* Fixed get workers count function (#261)

* Fixing change of named parameter in makeCluster (#259)

Parameter name looks to have changed. Fixing. There are still some issues that I will open a separate ticket for.

* Fixed resource files docs (#262)

* Added change log details (#258)

* Fix/getstartdoc (#263)

* fix AAD credential config field names

* fix json format

* add sharedKey to credentials related code and doc (#266)

* Fix/storage management (#267)

* Removed rAzureBatch from storage api calls

* Fixed quota documentation

* Added job and core quota limits

* Replaced deprecated function (#269)

* Fixed output (#270)

* Feature/custom package (#272)

* Added custom package script

* Added feature custom download

* Fixed typo

* Fixed directory for installation

* Fixed full folder directory

* Add dependencies and fix pattern

* Fix pattern not found

* Added repo

* Switching to devtools

* Fixing devtools install with directory

* Fix in for merger.R

* Working cluster custom packages

* Removed printed statements

* Working on custom docs

* Custom packages sample docs

* Fixed typo in azure files typo

* Fixed typos based on PR

* Documentation rewrite (#273)

* Renamed operations

* Fixing docs

* Removed stuff from README.md

* Fixed links for TOC

* Added descriptions for TOC

* Major renaming of files

* Added TOC to main README.md

* Added low pri link

* Added link to vm priority

* Fix broken links

* Added Notable features

* Clarifying comment on DSVM (#274)

* Tests/r (#275)

* 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

* Switched to R6 sas client (#276)

* Switched to R6 sas client

* Added storage endpoint suffix

* Fixed package strip name (#278)

* Fix: Updated MaxTasksPerNode documentation (#279)

* Added comment on maxTasksPerNode

* Added bolded note

* After comments

* Fix: Updating Persistent Storage Documentation  (#283)

* Switched to R6 client

* Replaced createContainer function

* CHANGELOG for v0.7.1 (#285)

* Added 0.7.1 changelog version (#286)
  • Loading branch information
brnleehng authored Jul 13, 2018
1 parent 6e78b09 commit c89abec
Show file tree
Hide file tree
Showing 102 changed files with 5,343 additions and 1,766 deletions.
10 changes: 10 additions & 0 deletions .github/issue_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
Before submitting a bug please check the following:
- [ ] Start a new R session
- [ ] Check your credentials file
- [ ] Install the latest doAzureParallel package
- [ ] Submit a minimal, reproducible example
- [ ] run `sessionInfo()`

**Description**

**Instruction to repro the problem if applicable**
2 changes: 1 addition & 1 deletion .lintr
Original file line number Diff line number Diff line change
@@ -1 +1 @@
exclusions: list("R/validationUtilities.R")
exclusions: list("R/validationUtilities.R", "R/batchApi.R")
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ warnings_are_errors: false
r_github_packages:
- Azure/rAzureBatch
- jimhester/lintr
- hadley/nycflights13
280 changes: 219 additions & 61 deletions CHANGELOG.md

Large diffs are not rendered by default.

7 changes: 4 additions & 3 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: doAzureParallel
Type: Package
Title: doAzureParallel
Version: 0.6.0
Version: 0.7.1
Author: Brian Hoang
Maintainer: Brian Hoang <brhoan@microsoft.com>
Description: The project is for data experts who use R at scale. The project
Expand All @@ -17,7 +17,7 @@ Depends:
foreach (>= 1.4.3),
iterators (>= 1.0.8)
Imports:
rAzureBatch (>= 0.5.3),
rAzureBatch (>= 0.6.0),
jsonlite,
rjson,
xml2,
Expand All @@ -27,5 +27,6 @@ Suggests:
caret,
plyr,
lintr
Remotes: Azure/rAzureBatch@v0.5.3
Remotes:
Azure/rAzureBatch@v0.6.1
RoxygenNote: 6.0.1
5 changes: 5 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
# Generated by roxygen2: do not edit by hand

export(createOutputFile)
export(deleteJob)
export(deleteStorageContainer)
export(deleteStorageFile)
export(generateClusterConfig)
export(generateCredentialsConfig)
export(getCluster)
export(getClusterFile)
export(getClusterList)
export(getJob)
export(getJobFile)
export(getJobList)
Expand All @@ -16,11 +19,13 @@ export(listStorageFiles)
export(makeCluster)
export(registerDoAzureParallel)
export(resizeCluster)
export(setAutoDeleteJob)
export(setChunkSize)
export(setCredentials)
export(setHttpTraffic)
export(setReduce)
export(setVerbose)
export(stopCluster)
export(terminateJob)
export(waitForNodesToComplete)
export(waitForTasksToComplete)
8 changes: 5 additions & 3 deletions R/autoscale.R
Original file line number Diff line number Diff line change
Expand Up @@ -96,17 +96,19 @@ resizeCluster <- function(cluster,
lowPriorityMax,
algorithm = "QUEUE",
timeInterval = "PT5M") {
pool <- rAzureBatch::getPool(cluster$poolId)
config <- getOption("az_config")
cluster <- config$batchClient$poolOperations$getPool(
cluster$poolId)

rAzureBatch::resizePool(
config$batchClient$poolOperations$resizePool(
cluster$poolId,
autoscaleFormula = getAutoscaleFormula(
algorithm,
dedicatedMin,
dedicatedMax,
lowPriorityMin,
lowPriorityMax,
maxTasksPerNode = pool$maxTasksPerNode
maxTasksPerNode = cluster$maxTasksPerNode
),
autoscaleInterval = timeInterval
)
Expand Down
287 changes: 287 additions & 0 deletions R/batch-api.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,287 @@
BatchUtilities <- R6::R6Class(
"BatchUtilities",
public = list(
initialize = function(){

},
addTask = function(jobId, taskId, rCommand, ...) {
config <- getConfiguration()
storageClient <- config$storageClient
batchClient <- config$batchClient

args <- list(...)
.doAzureBatchGlobals <- args$envir
dependsOn <- args$dependsOn
argsList <- args$args
cloudCombine <- args$cloudCombine
userOutputFiles <- args$outputFiles
containerImage <- args$containerImage

resultFile <- paste0(taskId, "-result", ".rds")
accountName <- storageClient$authentication$name

resourceFiles <- NULL
if (!is.null(argsList)) {
envFile <- paste0(taskId, ".rds")
saveRDS(argsList, file = envFile)
storageClient$blobOperations$uploadBlob(
jobId,
file.path(getwd(), envFile)
)
file.remove(envFile)

readToken <- storageClient$generateSasToken("r", "c", jobId)
envFileUrl <-
rAzureBatch::createBlobUrl(
storageClient$authentication$name,
jobId,
envFile,
readToken,
config$endpointSuffix)
resourceFiles <-
list(rAzureBatch::createResourceFile(url = envFileUrl, fileName = envFile))
}

# Only use the download command if cloudCombine is enabled
# Otherwise just leave it empty
commands <- c()

if (!is.null(cloudCombine)) {
assign("cloudCombine", cloudCombine, .doAzureBatchGlobals)
copyCommand <- sprintf(
"%s %s %s --download --saskey $BLOBXFER_SASKEY --remoteresource . --include results/*.rds --endpoint %s",
accountName,
jobId,
"$AZ_BATCH_TASK_WORKING_DIR",
config$endpointSuffix
)

downloadCommand <-
dockerRunCommand("alfpark/blobxfer:0.12.1", copyCommand, "blobxfer", FALSE)
commands <- c(downloadCommand)
}

exitConditions <- NULL
if (!is.null(args$dependsOn)) {
dependsOn <- args$dependsOn
}
else {
exitConditions <- list(default = list(dependencyAction = "satisfy"))
}

containerUrl <-
rAzureBatch::createBlobUrl(
storageAccount = storageClient$authentication$name,
containerName = jobId,
sasToken = storageClient$generateSasToken("w", "c", jobId),
storageEndpointSuffix = config$endpointSuffix
)

outputFiles <- list(
list(
filePattern = paste0(taskId, ".txt"),
destination = list(container = list(
path = paste0("logs/", taskId, ".txt"),
containerUrl = containerUrl
)),
uploadOptions = list(uploadCondition = "taskCompletion")
),
list(
filePattern = "../stdout.txt",
destination = list(container = list(
path = paste0("stdout/", taskId, "-stdout.txt"),
containerUrl = containerUrl
)),
uploadOptions = list(uploadCondition = "taskCompletion")
),
list(
filePattern = "../stderr.txt",
destination = list(container = list(
path = paste0("stderr/", taskId, "-stderr.txt"),
containerUrl = containerUrl
)),
uploadOptions = list(uploadCondition = "taskCompletion")
)
)

outputFiles <- append(outputFiles, userOutputFiles)

commands <-
c(commands,
dockerRunCommand(containerImage, rCommand))

commands <- linuxWrapCommands(commands)

sasToken <- storageClient$generateSasToken("rwcl", "c", jobId)
queryParameterUrl <- "?"

for (query in names(sasToken)) {
queryParameterUrl <-
paste0(queryParameterUrl,
query,
"=",
RCurl::curlEscape(sasToken[[query]]),
"&")
}

queryParameterUrl <-
substr(queryParameterUrl, 1, nchar(queryParameterUrl) - 1)

setting <- list(name = "BLOBXFER_SASKEY",
value = queryParameterUrl)

containerEnv <- list(name = "CONTAINER_NAME",
value = jobId)

batchClient$taskOperations$add(
jobId,
taskId,
environmentSettings = list(setting, containerEnv),
resourceFiles = resourceFiles,
commandLine = commands,
dependsOn = dependsOn,
outputFiles = outputFiles,
exitConditions = exitConditions
)
},
addJob = function(jobId,
poolId,
resourceFiles,
metadata,
...) {
args <- list(...)
packages <- args$packages
github <- args$github
bioconductor <- args$bioconductor
containerImage <- args$containerImage
poolInfo <- list("poolId" = poolId)

config <- getConfiguration()
batchClient <- config$batchClient

# Default command for job preparation task
# Supports backwards compatibility if zip packages are missing, it will be installed
# Eventually, apt-get install command will be deprecated
commands <- c(
"apt-get -y install zip unzip"
)

if (!is.null(packages)) {
jobPackages <-
dockerRunCommand(containerImage,
getJobPackageInstallationCommand("cran", packages),
jobId)
commands <- c(commands, jobPackages)
}

if (!is.null(github) && length(github) > 0) {
jobPackages <-
dockerRunCommand(containerImage,
getJobPackageInstallationCommand("github", github),
jobId)
commands <- c(commands, jobPackages)
}

if (!is.null(bioconductor) &&
length(bioconductor) > 0) {
jobPackages <-
dockerRunCommand(containerImage,
getJobPackageInstallationCommand("bioconductor", bioconductor),
jobId)
commands <- c(commands, jobPackages)
}

jobPreparationTask <- list(
commandLine = linuxWrapCommands(commands),
userIdentity = list(autoUser = list(
scope = "pool",
elevationLevel = "admin"
)),
waitForSuccess = TRUE,
resourceFiles = resourceFiles,
constraints = list(maxTaskRetryCount = 2)
)

usesTaskDependencies <- TRUE

response <- batchClient$jobOperations$addJob(
jobId,
poolInfo = poolInfo,
jobPreparationTask = jobPreparationTask,
usesTaskDependencies = usesTaskDependencies,
content = "response",
metadata = metadata
)

return(response)
},
addPool =
function(pool,
packages,
environmentSettings,
resourceFiles,
...) {
args <- list(...)
commands <- c()

config <- getConfiguration()
batchClient <- config$batchClient

if (!is.null(args$commandLine)) {
commands <- c(commands, args$commandLine)
}

startTask <- list(
commandLine = linuxWrapCommands(commands),
userIdentity = list(autoUser = list(
scope = "pool",
elevationLevel = "admin"
)),
waitForSuccess = TRUE
)

if (!is.null(environmentSettings)) {
startTask$environmentSettings <- environmentSettings
}

if (length(resourceFiles) > 0) {
startTask$resourceFiles <- resourceFiles
}

virtualMachineConfiguration <- list(
imageReference = list(
publisher = "Canonical",
offer = "UbuntuServer",
sku = "16.04-LTS",
version = "latest"
),
nodeAgentSKUId = "batch.node.ubuntu 16.04"
)

response <- batchClient$poolOperations$addPool(
pool$name,
pool$vmSize,
startTask = startTask,
virtualMachineConfiguration = virtualMachineConfiguration,
enableAutoScale = TRUE,
metadata = list(list(name = "origin", value = "doAzureParallel")),
autoscaleFormula = getAutoscaleFormula(
pool$poolSize$autoscaleFormula,
pool$poolSize$dedicatedNodes$min,
pool$poolSize$dedicatedNodes$max,
pool$poolSize$lowPriorityNodes$min,
pool$poolSize$lowPriorityNodes$max,
maxTasksPerNode = pool$maxTasksPerNode
),
autoScaleEvaluationInterval = "PT5M",
maxTasksPerNode = pool$maxTasksPerNode,
networkConfiguration = args$networkConfiguration,
content = "text"
)

return(response)
}
)
)

BatchUtilitiesOperations <- BatchUtilities$new()
Loading

0 comments on commit c89abec

Please sign in to comment.