Skip to content

Commit

Permalink
completes mirai re-design
Browse files Browse the repository at this point in the history
  • Loading branch information
shikokuchuo committed Mar 23, 2023
1 parent 9a0f2a6 commit 3891ddf
Show file tree
Hide file tree
Showing 11 changed files with 163 additions and 215 deletions.
4 changes: 2 additions & 2 deletions 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: 0.8.1.9001
Version: 0.8.1.9002
Description: Lightweight parallel code execution, local or distributed across
the network. Designed for simplicity, a 'mirai' evaluates an arbitrary
expression asynchronously, resolving automatically upon completion.
Expand All @@ -24,5 +24,5 @@ Encoding: UTF-8
Depends:
R (>= 2.12)
Imports:
nanonext (>= 0.8.0.9000)
nanonext (>= 0.8.0.9001)
RoxygenNote: 7.2.3
7 changes: 4 additions & 3 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -18,22 +18,23 @@ export(mirai)
export(server)
export(stop_mirai)
export(unresolved)
importFrom(nanonext,.unresolved)
importFrom(nanonext,base64dec)
importFrom(nanonext,call_aio)
importFrom(nanonext,context)
importFrom(nanonext,cv)
importFrom(nanonext,cv_value)
importFrom(nanonext,is_error_value)
importFrom(nanonext,listen)
importFrom(nanonext,mclock)
importFrom(nanonext,msleep)
importFrom(nanonext,opt)
importFrom(nanonext,parse_url)
importFrom(nanonext,pipe_notify)
importFrom(nanonext,random)
importFrom(nanonext,recv)
importFrom(nanonext,recv_aio)
importFrom(nanonext,recv_aio_signal)
importFrom(nanonext,reply)
importFrom(nanonext,request)
importFrom(nanonext,request_signal)
importFrom(nanonext,send)
importFrom(nanonext,socket)
importFrom(nanonext,stat)
Expand Down
8 changes: 5 additions & 3 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
# mirai 0.8.1.9001 (development)
# mirai 0.8.1.9002 (development)

* Internal improvements which ensure server processes exit if the connection is closed. This significantly lowers the chance of orphaned server processes.
* Requires nanonext >= [0.8.0.9000].
* `dispatcher()` has significantly higher throughput and lower latency, implementing an efficient non-polling design with no processor usage when idle. Arguments 'pollfreqh' and 'pollfreql' removed as no longer applicable.
* Server and dispatcher processes exit automatically if the connection with the client is dropped. This significantly reduces the likelihood of orphaned processes.
* Requires nanonext >= [0.8.0.9001].
* Internal performance enhancements.

# mirai 0.8.1

Expand Down
31 changes: 17 additions & 14 deletions R/mirai-package.R
Original file line number Diff line number Diff line change
Expand Up @@ -49,30 +49,33 @@
#' @author Charlie Gao \email{charlie.gao@@shikokuchuo.net}
#' (\href{https://orcid.org/0000-0002-0750-061X}{ORCID})
#'
#' @importFrom nanonext base64dec call_aio context cv is_error_value mclock
#' msleep opt parse_url pipe_notify random recv recv_aio recv_aio_signal
#' request send socket stat stop_aio unresolved .unresolved wait
#' @importFrom nanonext call_aio context cv cv_value is_error_value listen
#' mclock msleep opt parse_url pipe_notify random recv recv_aio_signal reply
#' request request_signal send socket stat stop_aio unresolved wait
#'
#' @docType package
#' @name mirai-package
#'
NULL

.onLoad <- function(libname, pkgname) {
.command <<- switch(.Platform[["OS.type"]],
windows = file.path(R.home("bin"), "Rscript.exe"),
file.path(R.home("bin"), "Rscript"))
.urlfmt <<- switch(Sys.info()[["sysname"]],
Linux = "abstract://n%.f",
Windows = "ipc://n%.f",
"ipc:///tmp/n%.f")
}
.onLoad <- function(libname, pkgname)
switch(Sys.info()[["sysname"]],
Linux = {
.command <<- file.path(R.home("bin"), "Rscript")
.urlfmt <<- "abstract://n%.f"
},
Windows = {
.command <<- file.path(R.home("bin"), "Rscript.exe")
.urlfmt <<- "ipc://n%.f"
},
{
.command <<- file.path(R.home("bin"), "Rscript")
.urlfmt <<- "ipc:///tmp/n%.f"
})

.onUnload <- function(libpath) for (i in names(..)) daemons(0L, .compute = i)

.command <- NULL
.urlfmt <- NULL
.statnames <- c("status_online", "status_busy", "tasks_assigned", "tasks_complete", "instance #")
.. <- `[[<-`(new.env(hash = FALSE), "default", new.env(hash = FALSE))
.__scm__. <- base64dec("WAoAAAADAAQCAQADBQAAAAAFVVRGLTgAAAD8", convert = FALSE)

Loading

0 comments on commit 3891ddf

Please sign in to comment.