@@ -587,7 +587,7 @@ loggedError.BatchtoolsFuture <- function(future, ...) {
587587
588588# ' @importFrom batchtools getLog
589589# ' @export
590- loggedOutput.BatchtoolsFuture <- function (future , ... ) {
590+ loggedOutput.BatchtoolsFuture <- function (future , timeout = NULL , ... ) {
591591 stat <- status(future )
592592 if (is_na(stat )) return (NULL )
593593
@@ -601,7 +601,19 @@ loggedOutput.BatchtoolsFuture <- function(future, ...) {
601601 reg <- config $ reg
602602 if (! inherits(reg , " Registry" )) return (NULL )
603603 jobid <- config $ jobid
604- getLog(id = jobid , reg = reg )
604+
605+ local({
606+ if (! is.null(timeout )) {
607+ stopifnot(length(timeout ) == 1 , is.numeric(timeout ), ! is.na(timeout ), timeout > = 0.0 )
608+ oldValue <- reg $ cluster.functions $ fs.latency
609+ on.exit(reg $ cluster.functions $ fs.latency <- oldValue )
610+ reg $ cluster.functions $ fs.latency <- timeout
611+ }
612+ out <- tryCatch(suppressWarnings({
613+ getLog(id = jobid , reg = reg )
614+ }), error = function (e ) NULL )
615+ })
616+ out
605617} # loggedOutput()
606618
607619
@@ -801,7 +813,7 @@ await <- function(future, cleanup = TRUE, ...) {
801813 # # whereas jobs that failed to launch won't. /HB 2025-07-15
802814
803815 hint <- tryCatch({
804- output <- loggedOutput(future )
816+ output <- loggedOutput(future , timeout = 0.0 )
805817 hint <- unlist(strsplit(output , split = " \n " , fixed = TRUE ))
806818 hint <- hint [nzchar(hint )]
807819 hint <- tail(hint , n = getOption(" future.batchtools.expiration.tail" , 48L ))
@@ -810,7 +822,7 @@ await <- function(future, cleanup = TRUE, ...) {
810822 hint <- c(" The last few lines of the logged output:" , hint )
811823 hint <- paste(hint , collapse = " \n " )
812824 } else {
813- hint <- " No logged output exist"
825+ hint <- " No logged output file exist"
814826 }
815827
816828 if (any(c(" submitted" , " started" ) %in% stat )) {
0 commit comments