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

Commit

Permalink
Reverted changes (#227)
Browse files Browse the repository at this point in the history
  • Loading branch information
brnleehng authored Feb 22, 2018
1 parent 9bba37f commit 5b8431f
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 18 deletions.
40 changes: 28 additions & 12 deletions R/doAzureParallel.R
Original file line number Diff line number Diff line change
Expand Up @@ -358,6 +358,7 @@ setHttpTraffic <- function(value = FALSE) {

retryCounter <- 0
maxRetryCount <- 5
startupFolderName <- "startup"

repeat {
if (retryCounter > maxRetryCount) {
Expand Down Expand Up @@ -395,17 +396,17 @@ setHttpTraffic <- function(value = FALSE) {
stop(paste0("Error creating job: ", containerContent$message$value))
}

nodeScriptsDir <- system.file("startup", package = "doAzureParallel")
nodeScriptsFiles <- list.files(nodeScriptsDir, full.names = TRUE)

nodeScriptsZip <- "node_scripts.zip"
# Zip Flags: Keeping console output clean and removing junk paths
utils::zip(nodeScriptsZip, files = nodeScriptsFiles, extras = "-j -q")

# Uploading common job files for the worker node
rAzureBatch::uploadBlob(id,
nodeScriptsZip)
file.remove(nodeScriptsZip)
system.file(startupFolderName, "worker.R", package = "doAzureParallel"))
rAzureBatch::uploadBlob(id,
system.file(startupFolderName, "merger.R", package = "doAzureParallel"))
rAzureBatch::uploadBlob(id,
system.file(startupFolderName, "install_github.R", package = "doAzureParallel"))
rAzureBatch::uploadBlob(id,
system.file(startupFolderName, "install_cran.R", package = "doAzureParallel"))
rAzureBatch::uploadBlob(id,
system.file(startupFolderName, "install_bioconductor.R", package = "doAzureParallel"))

# Creating common job environment for all tasks
jobFileName <- paste0(id, ".rds")
Expand All @@ -415,13 +416,28 @@ setHttpTraffic <- function(value = FALSE) {

# Creating read-only SAS token blob resource file urls
sasToken <- rAzureBatch::createSasToken("r", "c", id)
nodeScriptsZipUrl <-
rAzureBatch::createBlobUrl(storageCredentials$name, id, nodeScriptsZip, sasToken)
workerScriptUrl <-
rAzureBatch::createBlobUrl(storageCredentials$name, id, "worker.R", sasToken)
mergerScriptUrl <-
rAzureBatch::createBlobUrl(storageCredentials$name, id, "merger.R", sasToken)
installGithubScriptUrl <-
rAzureBatch::createBlobUrl(storageCredentials$name,
id,
"install_github.R",
sasToken)
installCranScriptUrl <-
rAzureBatch::createBlobUrl(storageCredentials$name, id, "install_cran.R", sasToken)
installBioConductorScriptUrl <-
rAzureBatch::createBlobUrl(storageCredentials$name, id, "install_bioconductor.R", sasToken)
jobCommonFileUrl <-
rAzureBatch::createBlobUrl(storageCredentials$name, id, jobFileName, sasToken)

requiredJobResourceFiles <- list(
rAzureBatch::createResourceFile(url = nodeScriptsZipUrl, fileName = nodeScriptsZip),
rAzureBatch::createResourceFile(url = workerScriptUrl, fileName = "worker.R"),
rAzureBatch::createResourceFile(url = mergerScriptUrl, fileName = "merger.R"),
rAzureBatch::createResourceFile(url = installGithubScriptUrl, fileName = "install_github.R"),
rAzureBatch::createResourceFile(url = installCranScriptUrl, fileName = "install_cran.R"),
rAzureBatch::createResourceFile(url = installBioConductorScriptUrl, fileName = "install_bioconductor.R"),
rAzureBatch::createResourceFile(url = jobCommonFileUrl, fileName = jobFileName)
)

Expand Down
7 changes: 1 addition & 6 deletions R/helpers.R
Original file line number Diff line number Diff line change
Expand Up @@ -148,12 +148,7 @@
poolInfo <- list("poolId" = poolId)

# 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",
"unzip -j $AZ_BATCH_JOB_PREP_WORKING_DIR/node_scripts.zip"
)
commands <- c("ls")

if (!is.null(packages)) {
jobPackages <-
Expand Down

0 comments on commit 5b8431f

Please sign in to comment.