-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Drop callr for mirai - Remove remotes from CLI suggests script
- Loading branch information
Showing
11 changed files
with
111 additions
and
129 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
new_runner <- function(engine) { | ||
mirai::daemons( | ||
n = 1L, | ||
dispatcher = FALSE, | ||
resilience = FALSE, | ||
autoexit = get_kill_signal(), | ||
output = TRUE, | ||
.compute = engine$config$runner_compute | ||
) | ||
engine$runner <- mirai::mirai( | ||
{ | ||
if (requireNamespace("box", quietly = TRUE)) { | ||
box::set_script_path(mod) # nolint: object_usage_linter. | ||
} | ||
plumber::pr(path) |> # nolint: object_usage_linter. | ||
middleware() |> | ||
plumber::pr_run( | ||
port = port, # nolint: object_usage_linter. | ||
host = host, # nolint: object_usage_linter. | ||
quiet = TRUE, | ||
debug = TRUE | ||
) | ||
}, | ||
port = engine$config$port, | ||
path = engine$config$entry_path, | ||
host = engine$config$host, | ||
middleware = middleware(engine), | ||
mod = file.path(getwd(), engine$config$entry_path), | ||
.compute = engine$config$runner_compute | ||
) | ||
|
||
i <- 0L | ||
timeout <- 1000L | ||
|
||
while (i < timeout && is_runner_alive(engine) && !is_plumber_running(engine)) { | ||
i <- i + 1L | ||
try(cli::cli_progress_update(.envir = parent.frame(n = 1L)), silent = TRUE) | ||
Sys.sleep(0.1) | ||
} | ||
|
||
if (i == timeout && !is_plumber_running(engine)) { | ||
return(FALSE) | ||
} | ||
|
||
TRUE | ||
} | ||
|
||
kill_runner <- function(engine) { | ||
mirai::daemons(0L, .compute = engine$config$runner_compute) | ||
!is_runner_alive(engine$runner) | ||
} | ||
|
||
is_runner_alive <- function(engine) { | ||
mirai::unresolved(engine$runner) | ||
} | ||
|
||
get_kill_signal <- function() { | ||
tools::SIGKILL %|NA|% | ||
tools::SIGTERM %|NA|% | ||
tools::SIGINT | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,3 +3,7 @@ | |
`%||%` <- function(x, y) { | ||
if (is.null(x)) y else x | ||
} | ||
|
||
`%|NA|%` <- function(x, y) { | ||
if (is.na(x)) y else x | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,21 @@ | ||
# TODO | ||
|
||
## 2 | ||
## 1 | ||
|
||
- Cannot pass a plumber router to hotwater | ||
|
||
## 3 | ||
## 2 | ||
|
||
- It would be nice to remove callr dependency and just rely on mirai/nanonext | ||
- Updating CSS shouldn't typically cause a refresh | ||
|
||
## 6 | ||
## 3 | ||
|
||
- Updating CSS shouldn't typically cause a refresh | ||
- Look at using NNG js side for more advances msg passing | ||
|
||
## 7 | ||
## 4 | ||
|
||
- Nanonext is currently only used because I want an async connection for the local webpage refresh. May not need to use nanonext, considering we fake the protocol on the JS side of things anyway | ||
- The CLI messages are a bit all over the place, and errors don't always cause the progress bar to fail | ||
|
||
## 8 | ||
## 5 | ||
|
||
- The CLI messages are a bit all over the place, and errors don't always cause | ||
the progress bar to fail | ||
- Fix some global binding notes |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters