Create Mirai-based Controller (WebAssembly Compatible)
create_mirai_controller.RdCreates a mirai-based async controller for WebAssembly environments where crew is not available. Provides crew-compatible interface.
Value
List with crew-compatible interface:
push(name, command, data, globals, packages): Submit taskpop(scale): Retrieve completed taskterminate(): Shutdown daemons
Details
This function provides a crew-compatible interface using mirai instead
of crew. It's automatically used when running in WebR/WebAssembly
(detected by is_webr()).
The mirai backend uses:
mirai::daemons()for worker managementmirai::mirai()for task submissionBlocking
mirai[]for task retrieval
Examples
if (FALSE) { # \dontrun{
# Create mirai controller
controller <- create_mirai_controller(n_workers = 2)
# Submit task (crew-compatible interface)
controller$push(
name = "task1",
command = sum(x),
data = list(),
globals = list(x = 1:10),
packages = character()
)
# Retrieve result
result <- controller$pop()
# Clean up
controller$terminate()
} # }