mirai.promises
mirai.promises - Make 'Mirai' 'Promises'
Science Score: 13.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
✓codemeta.json file
Found codemeta.json file -
○.zenodo.json file
-
○DOI references
-
○Academic publication links
-
○Academic email domains
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (16.8%) to scientific vocabulary
Keywords
asynchronous-tasks
concurrency
distributed-computing
high-performance-computing
parallel-programming
promises
r
r-package
rstats
Last synced: 6 months ago
·
JSON representation
Repository
mirai.promises - Make 'Mirai' 'Promises'
Basic Info
Statistics
- Stars: 10
- Watchers: 2
- Forks: 0
- Open Issues: 0
- Releases: 9
Archived
Topics
asynchronous-tasks
concurrency
distributed-computing
high-performance-computing
parallel-programming
promises
r
r-package
rstats
Created over 2 years ago
· Last pushed almost 2 years ago
Metadata Files
Readme
License
Code of conduct
README.Rmd
---
output: github_document
---
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```
# mirai.promises
**This package is archived as promises implemented by `mirai >= 1.0.0` are superior to the ones provided here. The more efficient, next generation promises in `mirai` are completely event-driven and non-polling, allowing for higher scalability and lower latency.**
`mirai.promises` makes 'mirai' 'promises' for easy integration in 'plumber' or 'shiny' pipelines.
`mirai.promises` also makes [`nanonext`](https://cran.r-project.org/package=nanonext) 'recvAio' 'promises', working on asynchronous message receives.
`mirai` >= 0.11.1 already supports 'promises' out of the box. In this case, loading `mirai.promises` after `mirai` will mask the equivalent method to provide additional functionality offered by this package such as allowing a custom polling interval.
### Installation
Install the latest release from CRAN:
```{r cran, eval=FALSE}
install.packages("mirai.promises")
```
Or the development version from R-universe:
```{r runiv, eval=FALSE}
install.packages("mirai.promises", repos = "https://shikokuchuo.r-universe.dev")
```
### Polling Interval
`polling()` may be used to customise the frequency with which to poll for promise resolution (defaults to every 100 ms).
Package authors wishing to use the S3 methods contained within this package may simply import the `polling()` function to make them available.
### Example
The below example simulates a plot function requiring a long compute in a 'shiny' app.
This app takes c. 2s to start compared to the 8s it would otherwise take if the ‘long-running’ computations were not running on parallel workers.
```{r example, eval=FALSE}
library(shiny)
library(mirai)
library(promises)
library(mirai.promises)
polling(freq = 50L)
# set 4 persistent workers
daemons(n = 4L)
ui <- fluidPage(
fluidRow(
plotOutput("one"),
plotOutput("two"),
),
fluidRow(
plotOutput("three"),
plotOutput("four"),
)
)
make_plot <- function(time) {
Sys.sleep(time)
runif(10)
}
args <- list(make_plot = make_plot, time = 2)
server <- function(input, output, session) {
output$one <- renderPlot(mirai(make_plot(time), .args = args) %...>% plot())
output$two <- renderPlot(mirai(make_plot(time), .args = args) %...>% plot())
output$three <- renderPlot(mirai(make_plot(time), .args = args) %...>% plot())
output$four <- renderPlot(mirai(make_plot(time), .args = args) %...>% plot())
session$onSessionEnded(stopApp)
}
shinyApp(ui = ui, server = server)
```
### Thanks
[Joe Cheng](https://github.com/jcheng5) for optimising the promises method to work seamlessly within Shiny.
[Daniel Falbel](https://github.com/dfalbel/) for the original version of the above example and agreeing to its use here, as well as the specific use case that motivated this package.
### Links
`mirai.promises` on CRAN:
`mirai` website:
`mirai` on CRAN:
- High Performance Computing CRAN Task View:
`nanonext` website:
`nanonext` on CRAN:
--
### Code of Conduct
Please note that the mirai.promises project is released with a [Contributor Code of Conduct](https://contributor-covenant.org/version/2/1/CODE_OF_CONDUCT.html). By contributing to this project, you agree to abide by its terms.
Owner
- Login: shikokuchuo
- Kind: user
- Location: Cambridge, United Kingdom
- Company: Hibiki AI
- Website: https://shikokuchuo.net/
- Repositories: 8
- Profile: https://github.com/shikokuchuo
Research Scientist
GitHub Events
Total
Last Year
Packages
- Total packages: 1
-
Total downloads:
- cran 378 last-month
- Total dependent packages: 0
- Total dependent repositories: 0
- Total versions: 9
- Total maintainers: 1
cran.r-project.org: mirai.promises
Make 'Mirai' 'Promises'
- Homepage: https://shikokuchuo.net/mirai.promises/
- Documentation: http://cran.r-project.org/web/packages/mirai.promises/mirai.promises.pdf
- License: GPL (≥ 3)
- Status: removed
-
Latest release: 0.5.0
published almost 2 years ago
Rankings
Forks count: 21.8%
Dependent packages count: 29.2%
Stargazers count: 31.7%
Dependent repos count: 34.9%
Average: 41.5%
Downloads: 89.6%
Maintainers (1)
Last synced:
about 1 year ago
Dependencies
.github/workflows/R-CMD-check.yaml
actions
- actions/checkout v3 composite
- r-lib/actions/check-r-package v2 composite
- r-lib/actions/setup-pandoc v2 composite
- r-lib/actions/setup-r v2 composite
- r-lib/actions/setup-r-dependencies v2 composite
.github/workflows/pkgdown.yaml
actions
- JamesIves/github-pages-deploy-action v4.4.1 composite
- actions/checkout v3 composite
- r-lib/actions/setup-pandoc v2 composite
- r-lib/actions/setup-r v2 composite
- r-lib/actions/setup-r-dependencies v2 composite
.github/workflows/test-coverage.yaml
actions
- actions/checkout v3 composite
- r-lib/actions/setup-r v2 composite
- r-lib/actions/setup-r-dependencies v2 composite
DESCRIPTION
cran
- R >= 3.5 depends
- mirai >= 0.8.2 depends
- promises >= 1.1.0 depends
- later >= 1.0.0 imports
- nanonext >= 0.8.1 imports