diff --git a/articles/mirai.html b/articles/mirai.html index 6887967dd..0a084c452 100644 --- a/articles/mirai.html +++ b/articles/mirai.html @@ -154,7 +154,7 @@
[]
method:
m[]
-#> [1] 5.648591 3.123780 2.562778 4.690994 3.741629
As a mirai represents an async operation, it is never necessary to
wait for it. Other code can continue to be run. Once it completes, the
return value automatically becomes available at $data
.
m
#> < mirai [$data] >
m$data
-#> [1] 5.648591 3.123780 2.562778 4.690994 3.741629
+#> [1] 5.064930 4.823069 5.925715 3.792033 3.927049
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
@@ -174,7 +174,7 @@
The default dispatcher = "process"
creates a
dispatcher()
background process that connects to individual
daemon processes on the local machine. This ensures that tasks are
@@ -341,7 +341,7 @@
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 @@ -374,14 +374,14 @@
m <- mirai(capture.output(str(con)))
m[]
-#> [1] "Formal class 'SQLiteConnection' [package \"RSQLite\"] with 8 slots"
-#> [2] " ..@ ptr :<externalptr> "
-#> [3] " ..@ dbname : chr \"/tmp/RtmpQkiLoR/file315e24274ec8\""
-#> [4] " ..@ loadable.extensions: logi TRUE"
-#> [5] " ..@ flags : int 70"
-#> [6] " ..@ vfs : chr \"\""
-#> [7] " ..@ ref :<environment: 0x591cdf5fda58> "
-#> [8] " ..@ bigint : chr \"integer64\""
+#> [1] "Formal class 'SQLiteConnection' [package \"RSQLite\"] with 8 slots"
+#> [2] " ..@ ptr :<externalptr> "
+#> [3] " ..@ dbname : chr \"/tmp/RtmpwPybTL/file25fc764dffd\""
+#> [4] " ..@ loadable.extensions: logi TRUE"
+#> [5] " ..@ flags : int 70"
+#> [6] " ..@ vfs : chr \"\""
+#> [7] " ..@ ref :<environment: 0x5f4714304f98> "
+#> [8] " ..@ bigint : chr \"integer64\""
#> [9] " ..@ extended_types : logi FALSE"
Disconnect from the database everywhere, and set the number of daemons to zero to reset.
@@ -518,7 +518,7 @@The number of daemons connecting to the host URL is not limited and network resources may be added or removed at any time, with tasks automatically distributed to all connected daemons.
@@ -626,10 +626,10 @@Note that daemons()
should be set up on the host machine
@@ -666,37 +666,37 @@
launch_remote(1)
#> [1]
-#> Rscript -e 'mirai::daemon("wss://hostname:34529/1",tls=c("-----BEGIN CERTIFICATE-----
+#> Rscript -e 'mirai::daemon("wss://hostname:46075/1",tls=c("-----BEGIN CERTIFICATE-----
#> MIIFNzCCAx+gAwIBAgIBATANBgkqhkiG9w0BAQsFADAzMREwDwYDVQQDDAhrdW1h
#> bW90bzERMA8GA1UECgwITmFub25leHQxCzAJBgNVBAYTAkpQMB4XDTAxMDEwMTAw
#> MDAwMFoXDTMwMTIzMTIzNTk1OVowMzERMA8GA1UEAwwIa3VtYW1vdG8xETAPBgNV
#> BAoMCE5hbm9uZXh0MQswCQYDVQQGEwJKUDCCAiIwDQYJKoZIhvcNAQEBBQADggIP
-#> ADCCAgoCggIBAIwJZrzE16LSCgXGY7ZO1PKoJQconImfNxq3kMsTDuapmAbk1Nba
-#> 1tz1dTLGBFaexUK2mBd315TRVRAPDTSZ13/dTO53gRnhL3NFO6iJTdcIXr0UJTMe
-#> Ew1TjV6ZOdSlC4BL4lZ97GDysyRU8h9fnqLqzqdlPvz3h5dAbWBTQFMQlAROamFR
-#> ZnriT8Zv9PKF/kUZALxlYw+PUKr/wv+HGmq46t+wZvKvkJmFFHuNKi7O+DZlYU+d
-#> +bOKR5RhgEiEtKlmKyp6AgQncYRxCHJGMYW0Kt+H1/pkRBV3dsZXWUfO6jWYjJqe
-#> p76PzUxKi4JpuAwiBNqdluwz5aZMSC4gsNJ7CJw/hkdhe0nUIzNkCkMkoS9PR3sG
-#> 8cE52Uc0XPMROkzFeN2uxQjfWxTF93NknCzFILaAIIJ/I3xrjRk0+MYNqieAFw6u
-#> I397Deuw0oWNMaqyMXDxtRFm4ty6HGZjHk+p8V17vvEucr8cktTg44F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BEnNVLFT08iiV32mw7FGP5qHAw9M9jIaezOv
+#> gV9KCQaKR2XefhGxmolKcnKBCPqk/45baVUfvL7lei/XPTeBUg2S09YH2u7CoY4Z
+#> 4idhRHvjBWMpsCRynjrwXQjA0LVnwthQbVYsXPmAXjbwlUD7iYHDGKNhAwTahNPO
+#> 1lNp53+IK44VzZqRsQC9ErnBoxCAN56PZsRonZV0rkCT1eBzxgSJARp7wajYn6n2
+#> p1Rf+Ykyqep2AVuhfqt5cw090cQ/PU3TfqSfnC9kWxdsD6VUXGhYCewXJLkrLIc6
+#> f8r3HQHPDARaPU2NiLBeLDOS560LROU3gkAJhuyRrwMEtjcgDb3ACmk8tSzQzZBX
+#> rrdT6GvjavMDWuZVZqXUFmCWAlcngcrkzLuB1q34jR+UNvKg5mayYG4A1EtIXb1W
+#> 20WcViLRJMDQqBxBKDNL4qKe3zZvqvD9quDXFPfkvyMQiliUcbJPYSscN+Kis36A
+#> qGxscwNqn3OqSh5D/ZaZk2FTNBtymC3HSoK4x1LBl+VGcj+l/o0+cGd6wA==
#> -----END CERTIFICATE-----
-#> ",""),rs=c(10407,-1054001662,854874523,-1881956320,-1950819935,531919598,4464279))'
+#> ",""),rs=c(10407,-751471243,1312489394,-1544762485,377490768,-1836599023,-198832226))'
The printed value may be deployed directly on a remote machine.
@@ -1004,10 +1004,10 @@.args
is used to specify further constant arguments to
.f
- the ‘mean’ and ‘sd’ in the example below:
@@ -1016,13 +1016,13 @@Key advantages: mirai_map(1:3, rnorm, .args = list(mean = 20, sd = 2))[] ) #> [[1]] -#> [1] 20.54342 +#> [1] 20.0413 #> #> [[2]] -#> [1] 17.98820 17.88564 +#> [1] 21.61520 19.84004 #> #> [[3]] -#> [1] 20.15189 21.43710 23.64799
Use ...
to further specify objects referenced but not
defined in .f
- the ‘do’ in the anonymous function
below:
Use of mirai_map()
assumes that daemons()
have previously been set. If not then one (non-dispatcher) daemon is set
to allow the function to proceed. This ensures safe behaviour, but is
@@ -1126,7 +1126,7 @@
There are hence few requirements of package authors.
-The following may nonetheless be helpful:
+The following points may, however, be useful:
daemons()
settings should usually be left to
end-users. Users may be guided to mirai documentation if desired. If
@@ -1150,14 +1150,21 @@
This is recommended practice in any case, but especially relevant
+for package developers: the functions unresolved()
,
+is_error_value()
, is_mirai_error()
, and
+is_mirai_interrupt()
should be used to test for the
+relevant state of a mirai or its value. The characteristics of how they
+are currently implemented, e.g. as a logical NA for an
+‘unresolvedValue’, should not be relied upon, as these are subject to
+change.
Testing on CRAN should respect it’s 2-core usage limit. This
practically means limiting tests to using one daemon (with
dispatcher = "none"
) to ensure that only one additional
process is used. Always reset daemons when done and then allow at least
a one-second sleep to ensure all background processes have properly
-exited. These limits only apply to CRAN of course, and it is always
-possible to run a full suite of tests involving further daemons options
-in other contexts.
host_url()
-#> [1] "tcp://fv-az1149-82:0"
+#> [1] "tcp://fv-az665-182:0"
host_url(ws = TRUE)
-#> [1] "ws://fv-az1149-82:0"
+#> [1] "ws://fv-az665-182:0"
host_url(tls = TRUE)
-#> [1] "tls+tcp://fv-az1149-82:0"
+#> [1] "tls+tcp://fv-az665-182:0"
host_url(ws = TRUE, tls = TRUE, port = 5555)
-#> [1] "wss://fv-az1149-82:5555"
+#> [1] "wss://fv-az665-182:5555"
local_url()
-#> [1] "abstract://bc91a2de2b528bd48f5b7f55"
+#> [1] "abstract://037e626d383ca42af99b9a93"