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

Revert changes from node scripts #227

Merged
merged 1 commit into from
Feb 22, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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