Skip to content

Commit

Permalink
regenerate README and vignettes
Browse files Browse the repository at this point in the history
  • Loading branch information
shikokuchuo committed Oct 26, 2023
1 parent 46982f6 commit 5a78d0f
Show file tree
Hide file tree
Showing 6 changed files with 58 additions and 58 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Encoding: UTF-8
Depends:
R (>= 3.5)
Imports:
nanonext (>= 0.10.2.9011),
nanonext (>= 0.10.2.9012),
parallel
Enhances:
promises
Expand Down
2 changes: 1 addition & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
* Fixes supplying an `ssh_config()` specifying tunnelling to the 'remote' argument of `daemons()`.
* Fixes the print method for a subset 'miraiCluster' (thanks @HenrikBengtsson #83).
* Removes the deprecated deferred evaluation pipe `%>>%`.
* Requires nanonext >= [0.10.2.9011].
* Requires nanonext >= [0.10.2.9012].

# mirai 0.11.0

Expand Down
2 changes: 1 addition & 1 deletion README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ knitr::opts_chunk$set(

<!-- badges: start -->
[![CRAN status](https://www.r-pkg.org/badges/version/mirai?color=112d4e)](https://CRAN.R-project.org/package=mirai)
[![mirai status badge](https://shikokuchuo.r-universe.dev/badges/mirai?color=24a60e)](https://shikokuchuo.r-universe.dev/)
[![mirai status badge](https://shikokuchuo.r-universe.dev/badges/mirai?color=24a60e)](https://shikokuchuo.r-universe.dev/builds)
[![R-CMD-check](https://github.com/shikokuchuo/mirai/workflows/R-CMD-check/badge.svg)](https://github.com/shikokuchuo/mirai/actions)
[![codecov](https://codecov.io/gh/shikokuchuo/mirai/branch/main/graph/badge.svg)](https://app.codecov.io/gh/shikokuchuo/mirai)
[![DOI](https://zenodo.org/badge/459341940.svg)](https://zenodo.org/badge/latestdoi/459341940)
Expand Down
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
[![CRAN
status](https://www.r-pkg.org/badges/version/mirai?color=112d4e)](https://CRAN.R-project.org/package=mirai)
[![mirai status
badge](https://shikokuchuo.r-universe.dev/badges/mirai?color=24a60e)](https://shikokuchuo.r-universe.dev/)
badge](https://shikokuchuo.r-universe.dev/badges/mirai?color=24a60e)](https://shikokuchuo.r-universe.dev/builds)
[![R-CMD-check](https://github.com/shikokuchuo/mirai/workflows/R-CMD-check/badge.svg)](https://github.com/shikokuchuo/mirai/actions)
[![codecov](https://codecov.io/gh/shikokuchuo/mirai/branch/main/graph/badge.svg)](https://app.codecov.io/gh/shikokuchuo/mirai)
[![DOI](https://zenodo.org/badge/459341940.svg)](https://zenodo.org/badge/latestdoi/459341940)
Expand Down Expand Up @@ -88,17 +88,17 @@ result.

``` r
m$data
#> [1] -0.17710697 0.46078641 0.88270074 0.06083251 0.05059646 1.00000000
#> [7] 19.76422946 16.43857757 1.13288678 2.17020290 -5.64630529
#> [1] 2.2561892 1.1985734 1.4094865 0.8684176 0.8238311 1.0000000 1.2138410
#> [8] 1.1515197 0.7094783 0.8343252 0.4432252
```

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

``` r
call_mirai(m)$data
#> [1] -0.17710697 0.46078641 0.88270074 0.06083251 0.05059646 1.00000000
#> [7] 19.76422946 16.43857757 1.13288678 2.17020290 -5.64630529
#> [1] 2.2561892 1.1985734 1.4094865 0.8684176 0.8238311 1.0000000 1.2138410
#> [8] 1.1515197 0.7094783 0.8343252 0.4432252
```

### Vignette
Expand Down
98 changes: 49 additions & 49 deletions vignettes/mirai.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -69,15 +69,15 @@ Upon completion, the 'mirai' resolves automatically to the evaluated result.

```r
m$data |> str()
#> num [1:100000000] -0.881 -0.16 0.678 0.459 -0.269 ...
#> num [1:100000000] 57.804 -1.941 -7.661 0.387 0.777 ...
```

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


```r
call_mirai(m)$data |> str()
#> num [1:100000000] -0.881 -0.16 0.678 0.459 -0.269 ...
#> num [1:100000000] 57.804 -1.941 -7.661 0.387 0.777 ...
```

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 @@ -94,7 +94,7 @@ args <- list(m = runif(1), n = 1e8)
m <- mirai(.expr = expr, .args = args)

call_mirai(m)$data |> str()
#> num [1:100000000] 0.589 -1.306 0.967 -3.723 1.293 ...
#> num [1:100000000] 0.123 0.733 0.649 1.472 5.71 ...
```

[&laquo; Back to ToC](#table-of-contents)
Expand Down Expand Up @@ -180,8 +180,8 @@ for (i in 1:10) {
#> iteration 4 successful
#> iteration 5 successful
#> iteration 6 successful
#> Error: random error
#> iteration 7 successful
#> Error: random error
#> iteration 8 successful
#> iteration 9 successful
#> iteration 10 successful
Expand Down Expand Up @@ -221,12 +221,12 @@ status()
#>
#> $daemons
#> i online instance assigned complete
#> abstract://ea4e4f73480ee03abf774685 1 1 1 0 0
#> abstract://82b472f5c4028c57e541f60d 2 1 1 0 0
#> abstract://519f74caf98fca0b1d949c2c 3 1 1 0 0
#> abstract://33f8257f9d4b687ff5784d2e 4 1 1 0 0
#> abstract://69463b3c8e108d9eb39c88f1 5 1 1 0 0
#> abstract://f5e5e9a3ca6b7c86faa3ea78 6 1 1 0 0
#> abstract://2c91f63f732bdd18c473ec80 1 1 1 0 0
#> abstract://3b690e927a6d8d9be7b8eb64 2 1 1 0 0
#> abstract://2c4aa81c2d6e20d10998049f 3 1 1 0 0
#> abstract://4521e936800ac3da2a5cce9e 4 1 1 0 0
#> abstract://96c4b425a2eda1175e24a33d 5 1 1 0 0
#> abstract://12f6dc8cdb6aa4fabed7300e 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 @@ -261,7 +261,7 @@ status()
#> [1] 6
#>
#> $daemons
#> [1] "abstract://403671466c70abcf0b9cc5ed"
#> [1] "abstract://d5a7ab71b50c27f6e81196d0"
```

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 @@ -352,7 +352,7 @@ By specifying `dispatcher = FALSE`, remote daemons connect directly to the host

```r
daemons(url = host_url(), dispatcher = FALSE)
#> [1] "tcp://hostname:42425"
#> [1] "tcp://hostname:35033"
```

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 @@ -368,7 +368,7 @@ status()
#> [1] 0
#>
#> $daemons
#> [1] "tcp://hostname:42425"
#> [1] "tcp://hostname:35033"
```

To reset all connections and revert to default behaviour:
Expand Down Expand Up @@ -445,10 +445,10 @@ daemons(n = 2, url = host_url())

launch_remote(1:2)
#> [1]
#> Rscript -e "mirai::daemon('tcp://hostname:34249',rs=c(10407,-1105765197,-987934120,-1476302727,65523174,-1275424977,1746471844))"
#> Rscript -e "mirai::daemon('tcp://hostname:40815',rs=c(10407,-1298605964,-1613285147,639709282,1751824507,-1051788928,-932623487))"
#>
#> [2]
#> Rscript -e "mirai::daemon('tcp://hostname:37533',rs=c(10407,1082223346,-259998318,-1749716360,1849777031,1147350196,-1875717415))"
#> Rscript -e "mirai::daemon('tcp://hostname:39985',rs=c(10407,1124331931,1808224896,-1742832536,-639982197,-1545947632,1369966981))"

daemons(0)
#> [1] 0
Expand Down Expand Up @@ -480,37 +480,37 @@ The generated self-signed certificate is available via `launch_remote()`. This f
```r
launch_remote(1)
#> [1]
#> Rscript -e "mirai::daemon('wss://hostname:36005/1',tls=c('-----BEGIN CERTIFICATE-----
#> Rscript -e "mirai::daemon('wss://hostname:44085/1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khPvRrC/6FMrQFT442Pq9ZMRaF2
#> 7b7lbdjfX+JCnR5xKbVS4aw/pJrtG/D2z+I5qMeCLJ4MqJNECE6kxC/w1Iq3N4iN
#> Cd+gbstgHEAihS+ySife7uv4gbWu++xOESNJ4RRNZmksjhddRkQfy+nCMsFBbisC
#> T5JL43Jx2ASZXEaOPX7Q3URXO5xgTRTkFP/or10s4g2BaUya71AQheD6Z5uc/6kp
#> EaPys8D8HzD27GQ/ASLDeNlf5bTJaDhx/uzb8Q9KX2GA0x6gwKfGb+iX1w==
#> -----END CERTIFICATE-----
#> ',''),rs=c(10407,-612861450,1470179327,-2095842764,-186122331,-446162910,364318011))"
#> ',''),rs=c(10407,1009925696,-5957311,851346958,-714207433,-1893795316,680318877))"
```

The printed value may be deployed directly on a remote machine.
Expand Down Expand Up @@ -634,36 +634,36 @@ cl

parallel::parLapply(cl, 1:5, rnorm)
#> [[1]]
#> [1] -1.050956
#> [1] -0.9836203
#>
#> [[2]]
#> [1] 0.09537212 1.21054851
#> [1] 1.0656311 0.5503744
#>
#> [[3]]
#> [1] 0.7275608 0.4683658 -0.2090602
#> [1] 0.2525613 -0.8804021 0.5376508
#>
#> [[4]]
#> [1] -0.2758327 0.5478251 0.8320594 0.5868575
#> [1] -1.968415e-05 1.351948e+00 1.176134e+00 1.551765e+00
#>
#> [[5]]
#> [1] 1.37343219 1.65095515 0.60969256 0.84537855 -0.05773324
#> [1] -0.5270231 0.4128853 -0.1984081 0.8376930 -1.1472594

status(cl)
#> $connections
#> [1] 4
#>
#> $daemons
#> [1] "abstract://27d66a0c42c6b30cadeb5489"
#> [1] "abstract://757f162f5903b2ccf58e3782"

stop_cluster(cl)

cl <- make_cluster(n = 2, url = host_url())
#> Shell commands for deployment on nodes:
#> [1]
#> Rscript -e "mirai::daemon('tcp://hostname:42027',rs=c(10407,-30659088,-173672143,482412862,-582316889,-1971446596,1798213261))"
#> Rscript -e "mirai::daemon('tcp://hostname:39797',rs=c(10407,-1845852469,625033104,1695168081,-1539269666,1803884231,-226338724))"
#>
#> [2]
#> Rscript -e "mirai::daemon('tcp://hostname:42027',rs=c(10407,1389902600,123182236,2739438,206106783,-1575032522,-1704684541))"
#> Rscript -e "mirai::daemon('tcp://hostname:39797',rs=c(10407,-951338746,-573234744,-1153439598,1348855247,1553839924,-21456304))"

stop_cluster(cl)
```
Expand Down
2 changes: 1 addition & 1 deletion vignettes/precompile.R
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# Vignettes precompiled as require connecting to remote resources interactively
# Vignettes precompiled as require connecting to remote resources
knitr::knit("vignettes/mirai.Rmd.orig", "vignettes/mirai.Rmd")

0 comments on commit 5a78d0f

Please sign in to comment.