RStudio Connect scheduling content

Hi

I need to schedule content in RStudio Connect to run two times a day, at 7 AM and 3 PM. But the only option I seem to have in Connect is to schedule content to run on an interval, like every X hour but that doesn't solve my problem. Are there any ways to do this that I have missed?

Thanks,
Jakob

Thanks so much for sharing the feedback here!! Unfortunately, there is not a fantastic way to do this today. I have passed along this feedback to our product team so that we can consider this use case as we explore improvements to the product though!! These types of practical use cases are very helpful to that process!

A couple of workarounds that come to mind for me:

  • If this is an R Markdown report, make it a Parameterized R Markdown report. Each "variant" of a parameterized R Markdown report gets its own schedule, so you can add a "dummy" parameter and create two variants, scheduled at the two different times. Unfortunately, this will create two sets of "history" and two sets of "email distribution lists."

  • If that solution doesn't work, the other option would be to schedule the report at one of the times (i.e. 7AM), and schedule a separate report at the other time (i.e. 3 PM). The other report will be a silly little shell that triggers the "original" report to run. This is an undocumented and experimental pattern and something we are looking to improve / make first class in future versions. There is an R package that can help with this pattern if you choose to take this route:

# remotes::install_github("rstudio/connectapi")
library(connectapi)
client <- connect()
mymainreport <- content_item(client, "my-app-guid")
mymainreport_variant <- get_variant_default(mymainreport)
variant_render(mymainreport_variant)

There's not a great way to tail the log yet :see_no_evil: But that definitely seems like something that would be helpful.

I hope that helps! Please let us know which route you end up taking and how it goes! We are always eager to hear feedback on how things are going! :smile:

1 Like

Thanks for the reply Cole!

I have a workaround where the script is executed every hour and I wrap the code in an if-statement like this:

library(lubridate)

if (hour(now()) == 7 | hour(now()) == 15) {
 ...
} else {
 Do nothing
}

But it's a hack and it makes the "history" somewhat useless because most of them will be empty, but at least it works :slightly_smiling_face:

1 Like