generated from posit-conf-2023/workshop-template
-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
116 additions
and
0 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
--- | ||
title: "Asynchronous Processing" | ||
subtitle: "posit::conf(2023) <br> Shiny in Production: Tools & Techniques" | ||
author: "TBD" | ||
footer: "[{{< var workshop_short_url >}}]({{< var workshop_full_url >}})" | ||
format: | ||
revealjs: | ||
theme: [default, ../slides.scss] # moon= teal bg | dark | ||
scrollable: true | ||
incremental: false | ||
slide-number: c/t # c/t | c | h/v | h.v | ||
slide-tone: false #true | ||
code-line-numbers: true | ||
history: false | ||
revealjs-plugins: | ||
- codewindow | ||
--- | ||
|
||
## Single (threaded) Line {background-image="assets/img/lego_line_pay.jpg" background-size="cover"} | ||
|
||
* A single R process managing the different tasks in a Shiny application | ||
* Executed one-by-one | ||
|
||
# Should I care? | ||
|
||
## It Depends ... | ||
|
||
If you are the __only__ user for a quick and efficient app: Likely not | ||
|
||
::: {.notes} | ||
TODO: Find a way to center the sentence vertically in the slide | ||
::: | ||
|
||
## Crowd Pleaser | ||
|
||
Multiple users accessing the app __concurrently__: | ||
|
||
* Single-threaded R process serving multiple users in typical deployments | ||
|
||
## Asynchronous Processing (circa 2018) | ||
|
||
:::: {.columns} | ||
|
||
::: {.column width="50%"} | ||
|
||
### 📦 [`{promises}`](https://rstudio.github.io/promises/index.html) | ||
|
||
Handle objects representing the (eventual) result of an async operation | ||
|
||
::: | ||
|
||
::: {.column width="50%"} | ||
|
||
### 📦 [`{future}`](https://future.futureverse.org/) | ||
|
||
Launch tasks without blocking current R session | ||
|
||
::: | ||
|
||
:::: | ||
|
||
::: footer | ||
[Using promises with Shiny](https://rstudio.github.io/promises/articles/promises_06_shiny.html) | ||
::: | ||
|
||
## Introducing [`{crew}`](https://wlandau.github.io/crew/) | ||
|
||
> A distributed worker launcher for asynchronous tasks | ||
* Extends use of the [mirai](https://github.com/shikokuchuo/mirai) task scheduler to multiple computing backends | ||
* Central controller object manages tasks (scales on fly) | ||
* Supports multiple [controller groups](https://wlandau.github.io/crew/articles/controller_groups.html) for specialized worker types | ||
* Fits nicely with [`{targets}`](https://docs.ropensci.org/targets/) and ... | ||
|
||
. . . | ||
|
||
![](assets/img/shiny.png){.absolute top=0 left=200} | ||
|
||
## Setting up for Success | ||
|
||
1. Create functions for long-running tasks | ||
1. Create multiple [`reactiveVal`](https://shiny.posit.co/r/reference/shiny/latest/reactiveval) objects for bookkeeping | ||
1. Set up a `{crew}` controller | ||
1. Establish an event-driven push of task to the controller with monitoring of worker status |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
--- | ||
title: "Async Processing" | ||
subtitle: "TBD" | ||
author: "Eric Nantz & Michael Thomas" | ||
date: "2023-09-18" | ||
listing: | ||
- id: exercises | ||
contents: | ||
- ../materials/d1-9002-async/ex-*.qmd | ||
type: table | ||
fields: [subtitle, title] | ||
field-display-names: | ||
subtitle: "Exercise" | ||
sort: [filename] | ||
sort-ui: false | ||
filter-ui: false | ||
image-placeholder: assets/img/placeholder.png | ||
tbl-colwidths: [5,20,75] | ||
--- | ||
|
||
## Slides | ||
|
||
::: callout-warning | ||
These slides are under construction and will be finalized prior to the workshop date. | ||
::: | ||
|
||
[View slides in full screen](../materials/d1-9002-async/index.html) | ||
|
||
```{=html} | ||
<iframe class="slide-deck" src="../materials/d1-9002-async/" height="420" width="747" style="border: 1px solid #2e3846;"></iframe> | ||
``` | ||
|