Skip to content

Delayed progress updates to file due to file-system buffering [Was: No near-live progress update when running on a SLURM cluster] #149

Description

@frederikziebell

I want to run a loop in parallel on a SLURM cluster and use progressr to output near-live updates. Here's my setup:

test.R

library("future")
library("furrr")
library("progressr")

options(progressr.enable = TRUE)
handlers(global = TRUE)
handlers(handler_progress(
  format   = ":current/:total [:bar] :percent in :elapsed, ETA: :eta",
  width    = 60,
  complete = "="
))
plan(cluster)

f <- function(i) {
  Sys.sleep(3)
  i
}

local({
  n <- 100
  p <- progressor(n)
  result <- future_map(1:n, function(i){
    p(class = "sticky")
    f(i)
  })
})

test.sh

#!/bin/bash
#SBATCH --time=0-00:05:00
#SBATCH --ntasks 10
#SBATCH --output=slurm.out
Rscript test.R

The issue is that when the job is running, cat slurm.out always shows
0/100 [--------------------------------------------------] 0% in 0s, ETA: ? and no live progress is reported. How can I get it to show the current progress?

I have read this discussion on getting a progress bar using future.batchtools and that thread on printing messages to the console when they are generated, but I can't get it to work. Is this a bug?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions