Skip to content

Commit

Permalink
updates shell quoting for daemon launch commands
Browse files Browse the repository at this point in the history
  • Loading branch information
shikokuchuo committed Jun 18, 2024
1 parent a3107c5 commit 39ce672
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: mirai
Type: Package
Title: Minimalist Async Evaluation Framework for R
Version: 1.1.0.9000
Version: 1.1.0.9001
Description: High performance parallel code execution and distributed computing.
Designed for simplicity, a 'mirai' evaluates an R expression asynchronously,
on local or network resources, resolving automatically upon completion.
Expand Down
3 changes: 2 additions & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# mirai 1.1.0.9000 (development)
# mirai 1.1.0.9001 (development)

* Ephemeral daemons now exit as soon as permissible, eiliminating the 2s linger period.
* `dispatcher()` argument 'retry' now defaults to FALSE for consistency with non-dispatcher behaviour.
* Updates shell quoting of daemon launch commands.
* Requires `nanonext` >= [1.1.0.9000].

# mirai 1.1.0
Expand Down
8 changes: 4 additions & 4 deletions R/daemons.R
Original file line number Diff line number Diff line change
Expand Up @@ -589,16 +589,16 @@ parse_tls <- function(tls)
libp <- function(lp = .libPaths()) lp[file.exists(file.path(lp, "mirai"))][1L]

wa2 <- function(url, dots, tls = NULL)
shQuote(sprintf("mirai::daemon('%s'%s%s)", url, dots, parse_tls(tls)))
shQuote(sprintf("mirai::daemon(\"%s\"%s%s)", url, dots, parse_tls(tls)))

wa3 <- function(url, dots, rs, tls = NULL)
shQuote(sprintf("mirai::daemon('%s'%s%s,rs=c(%s))", url, dots, parse_tls(tls), paste0(rs, collapse = ",")))
shQuote(sprintf("mirai::daemon(\"%s\"%s%s,rs=c(%s))", url, dots, parse_tls(tls), paste0(rs, collapse = ",")))

wa4 <- function(urld, dots, rs, n, urlc)
shQuote(sprintf(".libPaths(c('%s',.libPaths()));mirai::dispatcher('%s',n=%d,rs=c(%s),monitor='%s'%s)", libp(), urld, n, paste0(rs, collapse= ","), urlc, dots))
shQuote(sprintf(".libPaths(c(\"%s\",.libPaths()));mirai::dispatcher(\"%s\",n=%d,rs=c(%s),monitor=\"%s\"%s)", libp(), urld, n, paste0(rs, collapse= ","), urlc, dots))

wa5 <- function(urld, dots, n, urlc, url)
shQuote(sprintf(".libPaths(c('%s',.libPaths()));mirai::dispatcher('%s',c('%s'),n=%d,monitor='%s'%s)", libp(), urld, paste0(url, collapse = "','"), n, urlc, dots))
shQuote(sprintf(".libPaths(c(\"%s\",.libPaths()));mirai::dispatcher(\"%s\",c(\"%s\"),n=%d,monitor=\"%s\"%s)", libp(), urld, paste0(url, collapse = "','"), n, urlc, dots))

launch_daemon <- function(args, output)
system2(command = .command, args = c("-e", args), stdout = output, stderr = output, wait = FALSE)
Expand Down
2 changes: 1 addition & 1 deletion R/mirai.R
Original file line number Diff line number Diff line change
Expand Up @@ -556,7 +556,7 @@ print.miraiInterrupt <- function(x, ...) {

ephemeral_daemon <- function(url) {
sock <- req_socket(url)
system2(command = .command, args = c("-e", shQuote(sprintf("mirai::.daemon('%s')", url))), stdout = FALSE, stderr = FALSE, wait = FALSE)
system2(command = .command, args = c("-e", shQuote(sprintf("mirai::.daemon(\"%s\")", url))), stdout = FALSE, stderr = FALSE, wait = FALSE)
sock
}

Expand Down

0 comments on commit 39ce672

Please sign in to comment.