Skip to content
Discussion options

You must be logged in to vote

Daemons are usually persistent processes, but they're quite flexible in supporting the kind of on-demand scaling you need.

I think you can achieve what you want with a pattern like this:

# Set up daemons
daemons(url = host_url())

Then within your server function:

task <- ExtendedTask$new(
  function(...) {
    # Start up a single Slurm worker that does one task and then exits
    launch_remote(1, remote = config, maxtasks = 1)
    mirai({Sys.sleep(y); runif(x)}, ...)
  }
) |> bind_task_button("btn")

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by raphaelbetschart
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants