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

Commit

Permalink
address review feedback (#232)
Browse files Browse the repository at this point in the history
* address review feedback

* add reference to github and bioconductor packages in worker

* update package management sample
  • Loading branch information
zfengms authored Mar 14, 2018
1 parent be7efa5 commit d12b5db
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 8 deletions.
2 changes: 1 addition & 1 deletion docs/20-package-management.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Packages installed at the pool level benefit from only needing to be installed o

## Installing Packages on Pool Creation

Pool level packages support CRAN, GitHub and BioConductor packages. The packages are installed in a shared directory on the node. It is important to note that it is required to explicitly load any packages installed at the cluster level within the foreach loop. For example, if you installed xml2 on the cluster, you must explicityly load it before using it.
Pool level packages support CRAN, GitHub and BioConductor packages. The packages are installed in a shared directory on the node. It is important to note that it is required to explicitly load any packages installed at the cluster level within the foreach loop. For example, if you installed xml2 on the cluster, you must explicitly load it before using it.

```R
foreach (i = 1:4) %dopar% {
Expand Down
8 changes: 8 additions & 0 deletions inst/startup/worker.R
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,14 @@ for (package in azbatchenv$packages) {
library(package, character.only = TRUE)
}

for (package in azbatchenv$github) {
library(package, character.only = TRUE)
}

for (package in azbatchenv$bioconductor) {
library(package, character.only = TRUE)
}

ls(azbatchenv)
parent.env(azbatchenv$exportenv) <- getparentenv(azbatchenv$pkgName)

Expand Down
3 changes: 0 additions & 3 deletions samples/package_management/README.md

This file was deleted.

16 changes: 12 additions & 4 deletions samples/package_management/bioconductor.r
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#Please see documentation at docs/20-package-management.md for more details on packagement management.

# install packages
library(devtools)
install_github("azure/doazureparallel")
Expand All @@ -6,24 +8,30 @@ install_github("azure/doazureparallel")
library(doAzureParallel)

# set your credentials
setCredentials("credentials.json")
doAzureParallel::setCredentials("credentials.json")

# Create your cluster if not exist
cluster <- makeCluster("bioconductor_cluster.json")
cluster <- doAzureParallel::makeCluster("bioconductor_cluster.json")

# register your parallel backend
registerDoAzureParallel(cluster)
doAzureParallel::registerDoAzureParallel(cluster)

# check that your workers are up
getDoParWorkers()
doAzureParallel::getDoParWorkers()

summary <- foreach(i = 1:1) %dopar% {
library(GenomeInfoDb) # Already installed as part of the cluster configuration
library(IRanges) # Already installed as part of the cluster configuration

sessionInfo()
# Your algorithm
}

summary

summary <- foreach(i = 1:1, bioconductor=c('GenomeInfoDb', 'IRanges')) %dopar% {
sessionInfo()
# Your algorithm
}

summary

0 comments on commit d12b5db

Please sign in to comment.