A R package that allows users to submit parallel workloads in Azure
Перейти к файлу
Brian Hoang c89abec8d7
Merge master to stable v0.7.1 (#287)
* 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)
2018-07-13 15:54:23 -07:00
.github Merge master to stable v0.7.1 (#287) 2018-07-13 15:54:23 -07:00
R Merge master to stable v0.7.1 (#287) 2018-07-13 15:54:23 -07:00
docker-image Feature/container (#153) 2017-11-03 10:06:40 -07:00
docs Merge master to stable v0.7.1 (#287) 2018-07-13 15:54:23 -07:00
inst/startup Merge master to stable v0.7.1 (#287) 2018-07-13 15:54:23 -07:00
man Merge master to stable v0.7.1 (#287) 2018-07-13 15:54:23 -07:00
samples Merge master to stable v0.7.1 (#287) 2018-07-13 15:54:23 -07:00
tests Merge master to stable v0.7.1 (#287) 2018-07-13 15:54:23 -07:00
vignettes Created documentation 2017-02-15 21:27:55 -08:00
.Rbuildignore Added Travis CI (#23) 2017-06-13 18:04:08 -07:00
.gitattributes Change True/False to TRUE/FALSE in README example (#124) 2017-09-27 14:29:32 -07:00
.gitignore Feature/bio conductor docs (#106) 2017-09-07 09:39:03 -07:00
.lintr Merge master to stable v0.7.1 (#287) 2018-07-13 15:54:23 -07:00
.travis.yml Merge master to stable v0.7.1 (#287) 2018-07-13 15:54:23 -07:00
CHANGELOG.md Merge master to stable v0.7.1 (#287) 2018-07-13 15:54:23 -07:00
Contributing.md Updates to documentation 2017-02-17 07:46:25 -08:00
DESCRIPTION Merge master to stable v0.7.1 (#287) 2018-07-13 15:54:23 -07:00
LICENSE Initial commit 2017-02-14 16:17:56 -08:00
NAMESPACE Merge master to stable v0.7.1 (#287) 2018-07-13 15:54:23 -07:00
README.md Merge master to stable v0.7.1 (#287) 2018-07-13 15:54:23 -07:00
account_setup.py Merge master to stable v0.7.1 (#287) 2018-07-13 15:54:23 -07:00
account_setup.sh Merge master to stable v0.7.1 (#287) 2018-07-13 15:54:23 -07:00

README.md

Build Status

doAzureParallel

Introduction

The doAzureParallel package is a parallel backend for the widely popular foreach package. With doAzureParallel, each iteration of the foreach loop runs in parallel on an Azure Virtual Machine (VM), allowing users to scale up their R jobs to tens or hundreds of machines.

doAzureParallel is built to support the foreach parallel computing package. The foreach package supports parallel execution - it can execute multiple processes across some parallel backend. With just a few lines of code, the doAzureParallel package helps create a cluster in Azure, register it as a parallel backend, and seamlessly connects to the foreach package.

NOTE: The terms pool and cluster are used interchangably throughout this document.

Notable Features

  • Ability to use low-priority VMs for an 80% discount (link)
  • Users can bring their own Docker Image
  • AAD and VNets Support
  • Built in support for Azure Blob Storage

Dependencies

  • R (>= 3.3.1)
  • httr (>= 1.2.1)
  • rjson (>= 0.2.15)
  • RCurl (>= 1.95-4.8)
  • digest (>= 0.6.9)
  • foreach (>= 1.4.3)
  • iterators (>= 1.0.8)
  • bitops (>= 1.0.5)

Setup

  1. Install doAzureParallel directly from Github.
# install the package devtools
install.packages("devtools")

# install the doAzureParallel and rAzureBatch package
devtools::install_github("Azure/rAzureBatch")
devtools::install_github("Azure/doAzureParallel")
  1. Create an doAzureParallel's credentials file
library(doAzureParallel)
generateCredentials.json("credentials.json")
  1. Login or register for an Azure Account, navigate to Azure Cloud Shell
wget -q https://raw.githubusercontent.com/Azure/doAzureParallel/master/account_setup.sh &&
chmod 755 account_setup.sh &&
/bin/bash account_setup.sh
  1. Follow the on screen prompts to create the necessary Azure resources and copy the output into your credentials file. For more information, see Getting Started Scripts.

To Learn More:

Getting Started

Import the package

library(doAzureParallel)

Set up your parallel backend with Azure. This is your set of Azure VMs.

# 1. Generate your credential and cluster configuration files.  
generateClusterConfig("cluster.json")
generateCredentialsConfig("credentials.json")

# 2. Fill out your credential config and cluster config files.
# Enter your Azure Batch Account & Azure Storage keys/account-info into your credential config ("credentials.json") and configure your cluster in your cluster config ("cluster.json")

# 3. Set your credentials - you need to give the R session your credentials to interact with Azure
setCredentials("credentials.json")

# 4. Register the pool. This will create a new pool if your pool hasn't already been provisioned.
cluster <- makeCluster("cluster.json")

# 5. Register the pool as your parallel backend
registerDoAzureParallel(cluster)

# 6. Check that your parallel backend has been registered
getDoParWorkers()

Run your parallel foreach loop with the %dopar% keyword. The foreach function will return the results of your parallel code.

number_of_iterations <- 10
results <- foreach(i = 1:number_of_iterations) %dopar% {
  # This code is executed, in parallel, across your cluster.
  myAlgorithm()
}

After you finish running your R code in Azure, you may want to shut down your cluster of VMs to make sure that you are not being charged anymore.

# shut down your pool
stopCluster(cluster)

Table of Contents

This section will provide information about how Azure works, how best to take advantage of Azure, and best practices when using the doAzureParallel package.

  1. Azure Introduction (link)

    Using Azure Batch

  2. Getting Started (link)

    Using the Getting Started to create credentials

    i. Generate Credentials Script (link)

    • Pre-built bash script for getting Azure credentials without Azure Portal

    ii. National Cloud Support (link)

    • How to run workload in Azure national clouds
  3. Customize Cluster (link)

    Setting up your cluster to user's specific needs

    i. Virtual Machine Sizes (link)

    • How do you choose the best VM type/size for your workload?

    ii. Autoscale (link)

    • Automatically scale up/down your cluster to save time and/or money.

    iii. Building Containers (link)

    • Creating your own Docker containers for reproducibility
  4. Managing Cluster (link)

    Managing your cluster's lifespan

  5. Customize Job

    Setting up your job to user's specific needs

    i. Asynchronous Jobs (link)

    • Best practices for managing long running jobs

    ii. Foreach Azure Options (link)

    • Use Azure package-defined foreach options to improve performance and user experience

    iii. Error Handling (link)

    • How Azure handles errors in your Foreach loop?
  6. Package Management (link)

    Best practices for managing your R packages in code. This includes installation at the cluster or job level as well as how to use different package providers.

  7. Storage Management

    i. Distributing your Data (link)

    • Best practices and limitations for working with distributed data.

    ii. Persistent Storage (link)

    • Taking advantage of persistent storage for long-running jobs

    iii. Accessing Azure Storage through R (link)

    • Manage your Azure Storage files via R
  8. Performance Tuning (link)

    Best practices on optimizing your Foreach loop

  9. Debugging and Troubleshooting (link)

    Best practices on diagnosing common issues

  10. Azure Limitations (link)

    Learn about the limitations around the size of your cluster and the number of foreach jobs you can run in Azure.

Additional Documentation

Read our FAQ for known issues and common questions.

Next Steps

For more information, please visit our documentation.