Skip to content

Conversation

shikokuchuo
Copy link
Member

@shikokuchuo shikokuchuo commented Sep 9, 2025

Closes #435. For evaluating mirai in the current process. Enables use of browser() for interactive debugging.

daemons(sync = TRUE) sets synchronous evaluation for a given compute profile.

E.g.:

library(mirai)
daemons(sync = TRUE)
m <- mirai(
  {
    browser()
  },
  .args = list(x = 1)
)
daemons(0)

Would drop us into a browser instance with access to x.

Each mirai is evaluated separately so it works for mirai_map() etc. regardless of the number of evaluations.

library(mirai)
daemons(sync = TRUE, .compute = "sync")
with_daemons("sync", {
  mp <- mirai_map(1:3, \(x) Sys.getpid())
})
daemons(0, .compute = "sync")
mp[]
#> [[1]]
#> [1] 32155
#> 
#> [[2]]
#> [1] 32155
#> 
#> [[3]]
#> [1] 32155

Created on 2025-09-10 with reprex v2.1.1

@shikokuchuo shikokuchuo changed the title Sequential compute profile Synchronous compute profiles Sep 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Method to run mirai in the current R process
1 participant