knitr::opts_chunk$set( collapse = TRUE, comment = "#>" )
library(joblog)
lf <- paste0(tempfile(), ".jsonl") lg <- lgr::get_logger("jobs")$set_propagate(FALSE) lg$add_appender(lgr::AppenderJson$new(file = lf)) # normal job lg$list_log(job_start("example", repeats = Sys.Date(), timestamp = Sys.Date() - 1L)) lg$list_log(job_finished()) # mark the last job as finished # job that repeats tomorrow lg$list_log(job_start("example", repeats = Sys.Date() + 1L)) lg$list_log(job_finished()) # job that repeats today lg$list_log(job_start("example-due-today", repeats = Sys.Date(), timestamp = as.POSIXct(Sys.Date() - 1L))) lg$list_log(job_finished()) # job that is overdue repeats today lg$list_log(job_start("example-overdue", repeats = Sys.Date()-1L, timestamp = as.POSIXct(Sys.Date() - 2L))) lg$list_log(job_finished()) # currently running job lg$list_log(job_start("example-still-running"))
joblog provides helpers to extract jobs from a .jsonl log and comes with a print method that colors jobs whether they are overdue, due today or still running
print(scrape_joblog(lf))
unlink(lf)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.