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

Added optional retry count flag #235

Merged
merged 2 commits into from
Mar 20, 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
13 changes: 10 additions & 3 deletions R/doAzureParallel.R
Original file line number Diff line number Diff line change
Expand Up @@ -525,6 +525,11 @@ setHttpTraffic <- function(value = FALSE) {
endIndices[length(startIndices)] <- ntasks
}

maxTaskRetryCount <- 3
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we add some documentation and/or samples on how to use this new parameter? Or else how should user knows there is such an option?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think adding it to the wiki page is sufficient enough

if (!is.null(obj$options$azure$maxTaskRetryCount)) {
maxTaskRetryCount <- obj$options$azure$maxTaskRetryCount
}

tasks <- lapply(1:length(endIndices), function(i) {
startIndex <- startIndices[i]
endIndex <- endIndices[i]
Expand All @@ -540,15 +545,17 @@ setHttpTraffic <- function(value = FALSE) {
taskId = taskId,
rCommand = sprintf(
paste("Rscript --no-save --no-environ --no-restore --no-site-file",
"--verbose $AZ_BATCH_JOB_PREP_WORKING_DIR/worker.R %i %i %i > $AZ_BATCH_TASK_ID.txt"),
"--verbose $AZ_BATCH_JOB_PREP_WORKING_DIR/worker.R %i %i %i %s > $AZ_BATCH_TASK_ID.txt"),
startIndex,
endIndex,
isDataSet),
isDataSet,
as.character(obj$errorHandling)),
envir = .doAzureBatchGlobals,
packages = obj$packages,
outputFiles = obj$options$azure$outputFiles,
containerImage = data$containerImage,
args = args
args = args,
maxRetryCount = maxTaskRetryCount
)

cat("\r", sprintf("Submitting tasks (%s/%s)", i, length(endIndices)), sep = "")
Expand Down
10 changes: 9 additions & 1 deletion R/helpers.R
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@
userOutputFiles <- args$outputFiles
containerImage <- args$containerImage

maxTaskRetryCount <- 3
if (!is.null(args$maxTaskRetryCount)) {
maxTaskRetryCount <- args$maxTaskRetryCount
}

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

Expand Down Expand Up @@ -131,7 +136,10 @@
commandLine = commands,
dependsOn = dependsOn,
outputFiles = outputFiles,
exitConditions = exitConditions
exitConditions = exitConditions,
constraints = list(
maxTaskRetryCount = maxTaskRetryCount
)
)
}

Expand Down