You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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`.
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:
Further, by testing the return value of each 'mirai' for errors, error-handling code is then able to automate recovery and re-attempts, as in the above example. Further details on [error handling](#errors-interrupts-and-timeouts) can be found in the section below.
@@ -201,12 +200,12 @@ status()
201
200
#>
202
201
#> $daemons
203
202
#> i online instance assigned complete
204
-
#> abstract://f52b35b9a832a2152cb68451 1 1 1 0 0
205
-
#> abstract://033141983db5a787d41c6b62 2 1 1 0 0
206
-
#> abstract://f5b1e54c4524b0ad70f97cb1 3 1 1 0 0
207
-
#> abstract://0c2dde598cb4db7faea10fa5 4 1 1 0 0
208
-
#> abstract://4c233fb0f8673194b1f4e043 5 1 1 0 0
209
-
#> abstract://32c59496251de9055106a772 6 1 1 0 0
203
+
#> abstract://bb7da8970444e783a3f63281 1 1 1 0 0
204
+
#> abstract://faf804d9f786b1ccc4f76628 2 1 1 0 0
205
+
#> abstract://e8e180caa09bc41f4067298a 3 1 1 0 0
206
+
#> abstract://3faa8cb0dadbe3c24fc35133 4 1 1 0 0
207
+
#> abstract://bdca3dd925f7416391b86f12 5 1 1 0 0
208
+
#> abstract://2e4db69b3b9c198610e51062 6 1 1 0 0
210
209
```
211
210
The default `dispatcher = "process"` 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.
212
211
@@ -238,7 +237,7 @@ status()
238
237
#> [1] 6
239
238
#>
240
239
#> $daemons
241
-
#> [1] "abstract://d47e6c20df78276654d7893e"
240
+
#> [1] "abstract://1ebf9fad5f9a05dfb8def571"
242
241
```
243
242
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.
244
243
@@ -266,11 +265,11 @@ m <- mirai(capture.output(str(con)))
266
265
m[]
267
266
#> [1] "Formal class 'SQLiteConnection' [package \"RSQLite\"] with 8 slots"
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.
Use `...` to further specify objects referenced but not defined in `.f` - the 'do' in the anonymous function below:
779
778
@@ -785,16 +784,16 @@ ml <- mirai_map(
785
784
)
786
785
#> Warning: mirai is launching one local daemon for a map operation as none previously set
787
786
ml
788
-
#> < mirai map [3/3] >
787
+
#> < mirai map [1/3] >
789
788
ml[]
790
789
#> $a
791
-
#> [1] "c8"
790
+
#> [1] "88"
792
791
#>
793
792
#> $b
794
-
#> [1] 96 66
793
+
#> [1] 39 3b
795
794
#>
796
795
#> $c
797
-
#> [1] "6b20bb"
796
+
#> [1] "1b5f6c"
798
797
```
799
798
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 unlikely to be optimal, so please ensure daemons are set beforehand.
0 commit comments