@@ -224,6 +224,12 @@ setHttpTraffic <- function(value = FALSE) {
224224 assign(" bioconductor" , bioconductorPackages , .doAzureBatchGlobals )
225225 assign(" pkgName" , pkgName , .doAzureBatchGlobals )
226226
227+ isDataSet <- hasDataSet(argsList )
228+
229+ if (! isDataSet ) {
230+ assign(" argsList" , argsList , .doAzureBatchGlobals )
231+ }
232+
227233 if (! is.null(obj $ options $ azure $ job )) {
228234 id <- obj $ options $ azure $ job
229235 }
@@ -528,18 +534,26 @@ setHttpTraffic <- function(value = FALSE) {
528534 tasks <- lapply(1 : length(endIndices ), function (i ) {
529535 startIndex <- startIndices [i ]
530536 endIndex <- endIndices [i ]
531- taskId <- paste0(id , " -task" , i )
537+ taskId <- as.character(i )
538+
539+ args <- NULL
540+ if (isDataSet ) {
541+ args <- argsList [startIndex : endIndex ]
542+ }
532543
533544 .addTask(
534545 jobId = id ,
535546 taskId = taskId ,
536547 rCommand = sprintf(
537- " Rscript --vanilla --verbose $AZ_BATCH_JOB_PREP_WORKING_DIR/worker.R > $AZ_BATCH_TASK_ID.txt" ),
538- args = argsList [startIndex : endIndex ],
548+ " Rscript --vanilla --verbose $AZ_BATCH_JOB_PREP_WORKING_DIR/worker.R %i %i %i > $AZ_BATCH_TASK_ID.txt" ,
549+ startIndex ,
550+ endIndex ,
551+ isDataSet ),
539552 envir = .doAzureBatchGlobals ,
540553 packages = obj $ packages ,
541554 outputFiles = obj $ options $ azure $ outputFiles ,
542- containerImage = data $ containerImage
555+ containerImage = data $ containerImage ,
556+ args = args
543557 )
544558
545559 cat(" \r " , sprintf(" Submitting tasks (%s/%s)" , i , length(endIndices )), sep = " " )
@@ -548,14 +562,11 @@ setHttpTraffic <- function(value = FALSE) {
548562 return (taskId )
549563 })
550564
551- rAzureBatch :: updateJob(id )
552-
553565 if (enableCloudCombine ) {
554566 cat(" \n Submitting merge task" )
555- mergeTaskId <- paste0(id , " -merge" )
556567 .addTask(
557568 jobId = id ,
558- taskId = mergeTaskId ,
569+ taskId = " merge " ,
559570 rCommand = sprintf(
560571 " Rscript --vanilla --verbose $AZ_BATCH_JOB_PREP_WORKING_DIR/merger.R %s %s %s > $AZ_BATCH_TASK_ID.txt" ,
561572 length(tasks ),
@@ -564,14 +575,17 @@ setHttpTraffic <- function(value = FALSE) {
564575 ),
565576 envir = .doAzureBatchGlobals ,
566577 packages = obj $ packages ,
567- dependsOn = tasks ,
578+ dependsOn = list ( taskIdRanges = list ( list ( start = 1 , end = length( tasks )))) ,
568579 cloudCombine = cloudCombine ,
569580 outputFiles = obj $ options $ azure $ outputFiles ,
570581 containerImage = data $ containerImage
571582 )
572583 cat(" . . ." )
573584 }
574585
586+ # Updating the job to terminate after all tasks are completed
587+ rAzureBatch :: updateJob(id )
588+
575589 if (wait ) {
576590 if (! is.null(obj $ packages ) ||
577591 ! is.null(githubPackages ) ||
@@ -588,7 +602,7 @@ setHttpTraffic <- function(value = FALSE) {
588602 response <-
589603 rAzureBatch :: downloadBlob(
590604 id ,
591- paste0(" result/" , id , " - merge-result.rds" ),
605+ paste0(" result/" , " merge-result.rds" ),
592606 sasToken = sasToken ,
593607 accountName = storageCredentials $ name ,
594608 downloadPath = tempFile ,
0 commit comments