Asynchronous Processing of Long-Running Tasks in Shiny


Computationally-intensive workflows exist in the design, analysis, and simulation in all phases of clinical studies. The runtime of such workflows can be significantly longer than a Shiny app can practicably handle. In such situations, binding the execution of computational tasks with active browser sessions can be detrimental to the user experience, making both the tasks and the web application less reliable. We present a R based solution to accommodate long running workflows with asynchronous execution of background tasks. By utilizing functions from shiny, httr, plumber, and pins packages, one can construct scalable web applications capable of asynchronous processing that cover processing-block free task creation, execution, status query, and results retrieval. A Bayesian dose finding automation example will be used to illustrate how the proposed framework allows users to initiate long-running tasks remotely and review the results later without utilizing resources on their local devices.

Presented at 2022 Conference