Shutdown daemons when they are not used #434
-
Hi, I'm playing around using
This works, but it always occupies 4 jobs, no matter if anything needs to get submitted or not. When using
|
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
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") |
Beta Was this translation helpful? Give feedback.
-
Perfect, works like a charm. |
Beta Was this translation helpful? Give feedback.
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:
Then within your server function: