@@ -426,13 +426,24 @@ getJobResult <- function(jobId) {
426426 }
427427
428428 # if the job has failed task
429- if (job $ tasks $ failed > 0 && metadata $ errorHandling == " stop" ) {
430- stop(
431- sprintf(
432- " job %s has failed tasks and error handling is set to 'stop', no result will be avaialble" ,
433- job $ jobId
429+ if (job $ tasks $ failed > 0 ) {
430+ if (metadata $ errorHandling == " stop" ) {
431+ stop(
432+ sprintf(
433+ " job %s has failed tasks and error handling is set to 'stop', no result will be avaialble" ,
434+ job $ jobId
435+ )
434436 )
435- )
437+ } else {
438+ if (job $ tasks $ succeeded == 0 ) {
439+ stop(
440+ sprintf(
441+ " all tasks failed for job %s, no result will be avaialble" ,
442+ job $ jobId
443+ )
444+ )
445+ }
446+ }
436447 }
437448 }
438449
@@ -461,15 +472,12 @@ getJobResult <- function(jobId) {
461472
462473 if (is.vector(results )) {
463474 results <- readRDS(tempFile )
464- break
465-
475+ return (results )
466476 }
467477
468478 # wait for 10 seconds for the result to be available
469479 Sys.sleep(10 )
470480 }
471-
472- return (results )
473481}
474482
475483# ' Utility function for creating an output file
@@ -713,25 +721,30 @@ readMetadataBlob <- function(jobId) {
713721 downloadPath = tempFile ,
714722 overwrite = TRUE
715723 )
716- result <- readRDS(tempFile )
717- result <- xml2 :: as_xml_document(result )
718- chunkSize <- getXmlValues(result , " .//chunkSize" )
719- packages <- getXmlValues(result , " .//packages" )
720- errorHandling <- getXmlValues(result , " .//errorHandling" )
721- wait <- getXmlValues(result , " .//wait" )
722- enableCloudCombine <-
723- getXmlValues(result , " .//enableCloudCombine" )
724724
725- metadata <-
726- list (
727- chunkSize = chunkSize ,
728- packages = packages ,
729- errorHandling = errorHandling ,
730- enableCloudCombine = enableCloudCombine ,
731- wait = wait
732- )
725+ if (is.vector(result )) {
726+ result <- readRDS(tempFile )
727+ result <- xml2 :: as_xml_document(result )
728+ chunkSize <- getXmlValues(result , " .//chunkSize" )
729+ packages <- getXmlValues(result , " .//packages" )
730+ errorHandling <- getXmlValues(result , " .//errorHandling" )
731+ wait <- getXmlValues(result , " .//wait" )
732+ enableCloudCombine <-
733+ getXmlValues(result , " .//enableCloudCombine" )
734+
735+ metadata <-
736+ list (
737+ chunkSize = chunkSize ,
738+ packages = packages ,
739+ errorHandling = errorHandling ,
740+ enableCloudCombine = enableCloudCombine ,
741+ wait = wait
742+ )
733743
734- metadata
744+ metadata
745+ } else {
746+ stop(paste0(result , " \r\n " ))
747+ }
735748}
736749
737750areShallowEqual <- function (a , b ) {
0 commit comments