Skip to content

Commit

Permalink
CRAN release 0.12.1
Browse files Browse the repository at this point in the history
  • Loading branch information
shikokuchuo committed Feb 2, 2024
1 parent 64c2b5b commit 2c7600c
Show file tree
Hide file tree
Showing 15 changed files with 108 additions and 115 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: 0.12.0.9011
Version: 0.12.1
Description: Lightweight 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
2 changes: 1 addition & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# mirai 0.12.0.9011 (development)
# mirai 0.12.1

* Dispatcher initial sync timeout widened to 10s to allow for launching large numbers of daemons.
* Default for `ssh_config()` argument 'timeout' widened to 10 (seconds).
Expand Down
5 changes: 2 additions & 3 deletions R/mirai.R
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,14 @@
#' @param ... (optional) named arguments (name = value pairs) specifying
#' objects referenced in '.expr'. Used in addition to, and taking precedence
#' over, any arguments specified via '.args'.
#' @param .args (optional) \strong{either} a list of objects to be passed by
#' @param .args (optional) \strong{either} a list of objects passed by
#' \link{name} (found in the current scope), \strong{or else} a list of
#' name = value pairs, as in '...'.
#' @param .timeout [default NULL] for no timeout, or an integer value in
#' milliseconds. A mirai will resolve to an 'errorValue' 5 (timed out) if
#' evaluation exceeds this limit.
#' @param .compute [default 'default'] character value for the compute profile
#' to use (each compute profile has its own set of daemons for connecting to
#' different resources).
#' to use (each compute profile has its own independent set of daemons).
#'
#' @return A 'mirai' object.
#'
Expand Down
12 changes: 6 additions & 6 deletions R/next.R
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (C) 2023 Hibiki AI Limited <[email protected]>
# Copyright (C) 2023-2024 Hibiki AI Limited <[email protected]>
#
# This file is part of mirai.
#
Expand Down Expand Up @@ -35,8 +35,8 @@
#' For \code{nextstream}: This function should be called for its return
#' value when required. The function also has the side effect of
#' automatically advancing the stream stored within the compute profile.
#' This ensures that next time the function is called the correct value will
#' be returned.
#' This ensures that the next recursive stream is returned when the function
#' is called again.
#'
#' @examples
#' if (interactive()) {
Expand All @@ -62,9 +62,9 @@ nextstream <- function(.compute = "default") next_stream(..[[.compute]])
#' \code{nextget} retrieves the specified item from the specified compute
#' profile.
#'
#' @param x character value of item to retrieve. One of 'pid' (dispatcher process
#' ID), 'urls' (URLs dispatcher is listening at) or 'tls' (the stored client
#' TLS configuration to be sent to daemons).
#' @param x character value of item to retrieve. One of 'pid' (dispatcher
#' process ID), 'urls' (URLs dispatcher is listening at) or 'tls' (the
#' stored client TLS configuration for use by daemons).
#'
#' @return For \code{nextget}: the requested item, or else NULL if not present.
#'
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,17 +87,17 @@ result.

``` r
m$data
#> [1] 2.1008424 -1.1086334 -0.5883114 -0.1746657 -2.1993281 -0.4546843
#> [7] -5.7252220 -1.6997800 -0.9020114 0.4759995
#> [1] 6.34034300 -0.04935289 -16.62688852 -21.83976726 0.32279128
#> [6] 3.09797711 -0.04578803 -0.06014354 -20.26223825 0.15772017
```

Alternatively, explicitly call and wait for the result using
`call_mirai()`.

``` r
call_mirai(m)$data
#> [1] 2.1008424 -1.1086334 -0.5883114 -0.1746657 -2.1993281 -0.4546843
#> [7] -5.7252220 -1.6997800 -0.9020114 0.4759995
#> [1] 6.34034300 -0.04935289 -16.62688852 -21.83976726 0.32279128
#> [6] 3.09797711 -0.04578803 -0.06014354 -20.26223825 0.15772017
```

### Daemons
Expand Down
3 changes: 1 addition & 2 deletions man/daemons.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 2 additions & 3 deletions man/everywhere.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions man/launch_local.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 2 additions & 3 deletions man/mirai.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 6 additions & 7 deletions man/nextstream.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions man/saisei.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

82 changes: 41 additions & 41 deletions vignettes/mirai.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,13 @@ Upon completion, the 'mirai' resolves automatically to the evaluated result.

```r
m$data |> str()
#> num [1:100000000] -0.852 0.957 1.6 16.365 -0.223 ...
#> num [1:100000000] 0.403 1.447 1.004 0.364 1.525 ...
```
Alternatively, explicitly call and wait for the result using `call_mirai()`.

```r
call_mirai(m)$data |> str()
#> num [1:100000000] -0.852 0.957 1.6 16.365 -0.223 ...
#> num [1:100000000] 0.403 1.447 1.004 0.364 1.525 ...
```
For easy programmatic use of `mirai()`, '.expr' accepts a pre-constructed language object, and also a list of named arguments passed via '.args'. So, the following would be equivalent to the above:

Expand All @@ -81,7 +81,7 @@ args <- list(m = runif(1), n = 1e8)
m <- mirai(.expr = expr, .args = args)

call_mirai(m)$data |> str()
#> num [1:100000000] 1.35 4.56 3.15 1.08 2.09 ...
#> num [1:100000000] 3.105 -0.931 0.943 3.262 0.151 ...
```

[&laquo; Back to ToC](#table-of-contents)
Expand Down Expand Up @@ -160,8 +160,8 @@ for (i in 1:10) {
#> iteration 3 successful
#> iteration 4 successful
#> iteration 5 successful
#> Error: random error
#> iteration 6 successful
#> Error: random error
#> iteration 7 successful
#> iteration 8 successful
#> iteration 9 successful
Expand Down Expand Up @@ -197,12 +197,12 @@ status()
#>
#> $daemons
#> i online instance assigned complete
#> abstract://e4b32b332af77c0c95ee3fd9 1 1 1 0 0
#> abstract://fbebdbee9e5ec1dd20a1bebd 2 1 1 0 0
#> abstract://3289fdb9dbcb5833cf8a351c 3 1 1 0 0
#> abstract://5e5263fc9412beb099e9898a 4 1 1 0 0
#> abstract://3357f9e81300066916058170 5 1 1 0 0
#> abstract://6d7b135d8fa3fb4a3d27d246 6 1 1 0 0
#> abstract://08b4b97238bde0689bc9514b 1 1 1 0 0
#> abstract://63a8dca236eb13ad5303cdae 2 1 1 0 0
#> abstract://64a11588f7f48743a45c7bcc 3 1 1 0 0
#> abstract://f6e2b2f97f506bb617820921 4 1 1 0 0
#> abstract://73bfd5425ff5b62788bad26f 5 1 1 0 0
#> abstract://688211a2852bbecf432754e9 6 1 1 0 0
```
The default `dispatcher = TRUE` creates a `dispatcher()` background process that connects to individual daemon processes on the local machine. This ensures that tasks are dispatched efficiently on a first-in first-out (FIFO) basis to daemons for processing. Tasks are queued at the dispatcher and sent to a daemon as soon as it can accept the task for immediate execution.

Expand Down Expand Up @@ -231,7 +231,7 @@ status()
#> [1] 6
#>
#> $daemons
#> [1] "abstract://198a34d5cb2ec7c3213cce24"
#> [1] "abstract://8a07989c110b62dab5b65a4a"
```
This implementation sends tasks immediately, and ensures that tasks are evenly-distributed amongst daemons. This means that optimal scheduling is not guaranteed as the duration of tasks cannot be known *a priori*. As an example, tasks could be queued at a daemon behind a long-running task, whilst other daemons are idle having already completed their tasks.

Expand Down Expand Up @@ -321,7 +321,7 @@ By specifying `dispatcher = FALSE`, remote daemons connect directly to the host

```r
daemons(url = host_url(), dispatcher = FALSE)
#> [1] "tcp://hostname:36791"
#> [1] "tcp://hostname:36117"
```
Note that above, calling `host_url()` without a port value uses the default of '0'. This is a wildcard value that will automatically cause a free ephemeral port to be assigned. The actual assigned port is provided in the return value of the call, or it may be queried at any time via `status()`.

Expand All @@ -335,7 +335,7 @@ status()
#> [1] 0
#>
#> $daemons
#> [1] "tcp://hostname:36791"
#> [1] "tcp://hostname:36117"
```
To reset all connections and revert to default behaviour:

Expand Down Expand Up @@ -405,10 +405,10 @@ daemons(n = 2, url = host_url())

launch_remote(1:2)
#> [1]
#> Rscript -e "mirai::daemon('tcp://hostname:35249',rs=c(10407,125460311,-1825782868,-462132035,1199418458,1304270355,2005083192))"
#> Rscript -e "mirai::daemon('tcp://hostname:43115',rs=c(10407,-512668947,-1821112118,19352515,924029480,-1421864439,1967253046))"
#>
#> [2]
#> Rscript -e "mirai::daemon('tcp://hostname:37295',rs=c(10407,-1309072200,704490761,557509925,-2139379427,1830875484,1912038244))"
#> Rscript -e "mirai::daemon('tcp://hostname:38413',rs=c(10407,1394391231,-727687268,-591259728,-971773911,72728696,-575275953))"

daemons(0)
#> [1] 0
Expand Down Expand Up @@ -436,37 +436,37 @@ The generated self-signed certificate is available via `launch_remote()`. This f
```r
launch_remote(1)
#> [1]
#> Rscript -e "mirai::daemon('wss://hostname:40119/1',tls=c('-----BEGIN CERTIFICATE-----
#> Rscript -e "mirai::daemon('wss://hostname:38377/1',tls=c('-----BEGIN CERTIFICATE-----
#> MIIFNzCCAx+gAwIBAgIBATANBgkqhkiG9w0BAQsFADAzMREwDwYDVQQDDAhrdW1h
#> bW90bzERMA8GA1UECgwITmFub25leHQxCzAJBgNVBAYTAkpQMB4XDTAxMDEwMTAw
#> MDAwMFoXDTMwMTIzMTIzNTk1OVowMzERMA8GA1UEAwwIa3VtYW1vdG8xETAPBgNV
#> BAoMCE5hbm9uZXh0MQswCQYDVQQGEwJKUDCCAiIwDQYJKoZIhvcNAQEBBQADggIP
#> ADCCAgoCggIBAKFpTMii/hIW/TAuCJ0/Feq3kknLQh/RjPal9d+p9gDLgX+U+DdT
#> 8CJjtYnw5aO/eb1stqOywoNjWyTjg6WTe/aGH7akySW3xIkBSMwdbFqhET0XXkOY
#> /fMlv3mIx4O+3O5hjkmXYwq5MjVXUF08pLgUqQHFk8wyvcZBD5vjhkQmEZTJyqld
#> aLHeiDlgE3r+tDzO20EXT9Pw3BLRZ6fdQry/6wmzxc9tLUuXFi3E9CUF8kEQOyG+
#> F6xlJrxfk/5xMaCjZ8YQQR5QIZQRo8AW5OhezS+uOAXgDylVeGSox4HgwwAF/L7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#> DQEBCwUAA4ICAQBwSMRJQxw0Xn3nZc950qTy6aWhL9UuFU3K6gvLdR+DTTtS3XKd
#> K2cJUiFa99RGNH8QO0gzKb5jB/wNm6eLK2sw2wytb0KXy13fQ/IlEv02lP5PtyQ9
#> acQv9DeUE9Q1GOkYd1j/lNqJmd3Ka3dK555rfJiF+s8czMpZBCHueZHpqJ3EQFI2
#> gdtvkpSDWAPe6AjkKpJtO3IJ89VCWZAoj2k6dpkJUokytW6vI+5IpELJZn4voNQz
#> QtK3Z+Z9XOHg3nYE9B8n2GwYOE+mtU4utIA7+bn3NY5SKE58DY/Ub46EQYhuakYS
#> sls7DTJsmu4/Ff8rvWiS9cLA94CIap3/EmI51rkzZCjwCBIpLaFMwJkcCr7yfFlI
#> afvurXOdtOrzpwKTWJ+DHVvJUr/4QfjQWM36xRTqewuJo09PMMe8BUBEj9grxx5B
#> WId5pRs//nSQ1//FQ+D0x6kd4yIGqdSa7UYF2Q7OVPqugoEmPO8d0GeYBtbEsfdw
#> IhKTHS1lRE6P/TJLCMX9CZaCipeR1PTWsvfFxyQi+tWfF6pUOS1eZKHqXwNzfchy
#> 7IXahUfi52tUHb0/3Zvs6bAVO9VnkkhiYy4FeA57uo1kpxyHV0DMPcdcRwT8n78o
#> qZAcVptJiXXtMReinMYxhIHncdCrgXuTirmgqV4McBhEPpbnOFyWBMIiqA==
#> -----END CERTIFICATE-----
#> ',''),rs=c(10407,-568994202,-909779537,2103666724,-586663723,-1555213422,96228843))"
#> ',''),rs=c(10407,-1949455173,305385664,98036161,-1903821682,-341019721,-290458484))"
```
The printed value may be deployed directly on a remote machine.

Expand Down
6 changes: 3 additions & 3 deletions vignettes/parallel.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ status(cl)
#> [1] 4
#>
#> $daemons
#> [1] "abstract://3d4a4402496bfa98f98d2c2c"
#> [1] "abstract://dbfed51655e80d0b27a24cc6"

stop_cluster(cl)
```
Expand All @@ -62,10 +62,10 @@ cl <- make_cluster(n = 2, url = host_url())
#> Shell commands for deployment on nodes:
#>
#> [1]
#> Rscript -e "mirai::daemon('tcp://hostname:46385',rs=c(10407,1330589964,-1191976291,1617653946,461158131,253482904,1523997881))"
#> Rscript -e "mirai::daemon('tcp://hostname:42471',rs=c(10407,1544508607,-732721164,-718427547,-1315073054,-812390917,-1575491328))"
#>
#> [2]
#> Rscript -e "mirai::daemon('tcp://hostname:46385',rs=c(10407,749396609,-578276799,2131323632,1725456233,-1056170017,453431426))"
#> Rscript -e "mirai::daemon('tcp://hostname:42471',rs=c(10407,1287587055,-2075729006,752482380,-1547133862,-1770470198,1209753632))"

stop_cluster(cl)
```
Loading

0 comments on commit 2c7600c

Please sign in to comment.