Created
May 7, 2018 10:48
-
-
Save DavisVaughan/891854b16561cd3830ee4834f66459d1 to your computer and use it in GitHub Desktop.
Playing with RStudio Daily jobs
This file contains hidden or 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
| add_job <- function(name, status, progressUnits, | |
| actions, estimate, estimateRemaining, | |
| running, autoRemove, group) { | |
| rstudioapi::callFun("addJob", | |
| name = name, | |
| status = status, | |
| progressUnits = progressUnits, | |
| actions = actions, | |
| estimate = estimate, | |
| estimateRemaining = estimateRemaining, | |
| running = running, | |
| autoRemove = autoRemove, | |
| group = group) | |
| } | |
| remove_job <- function(job) { | |
| rstudioapi::callFun("removeJob", job = job) | |
| } | |
| add_job_progress <- function(job, units) { | |
| rstudioapi::callFun("addJobProgress", job = job, units = units) | |
| } | |
| # ------------------------------------------------------------------------------ | |
| job_id <- add_job( | |
| name = "My first job", | |
| status = "Working hard...", | |
| progressUnits = 50L, | |
| actions = NULL, | |
| estimate = NULL, | |
| estimateRemaining = NULL, | |
| running = TRUE, | |
| autoRemove = TRUE, | |
| group = NULL | |
| ) | |
| for(i in 1:50) { | |
| Sys.sleep(.1) | |
| add_job_progress(job_id, 1) | |
| } | |
| #remove_job("B82029A8") | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment