@@ -326,6 +326,7 @@ update_site <- function(sync_to_s3 = TRUE) {
326
326
if (! file_exists(template_path )) {
327
327
stop(" Template file does not exist." )
328
328
}
329
+
329
330
report_md_content <- readLines(template_path )
330
331
# Get the list of files in the reports directory
331
332
report_files <- dir_ls(reports_dir , regexp = " .*_prod_on_.*.html" )
@@ -478,14 +479,13 @@ sort_by_quantile <- function(forecasts) {
478
479
479
480
480
481
# ' Print recent targets errors.
481
- get_recent_targets_errors <- function (time_since = minutes( 60 ) ) {
482
- meta_df <- targets :: tar_meta()
482
+ get_targets_errors <- function (project = tar_path_store(), top_n = 10 ) {
483
+ meta_df <- targets :: tar_meta(store = project )
483
484
forecast_errors <- meta_df %> %
484
- filter(time > Sys.time() - time_since , ! is.na(parent ), ! is.na(error )) %> %
485
- arrange(desc(time )) %> %
485
+ filter(! is.na(parent ), ! is.na(error )) %> %
486
486
distinct(parent , error , .keep_all = TRUE ) %> %
487
- select( time , parent , error ) %> %
488
- mutate( parent = gsub( " forecast_ " , " " , parent ) )
487
+ mutate( parent = gsub( " forecast_ " , " " , parent ) ) %> %
488
+ slice_max( time , n = top_n )
489
489
490
490
# Print each error message, along with the parent target.
491
491
if (nrow(forecast_errors ) > 0 ) {
@@ -500,10 +500,9 @@ get_recent_targets_errors <- function(time_since = minutes(60)) {
500
500
}
501
501
502
502
other_errors <- meta_df %> %
503
- filter(time > Sys.time() - time_since , ! is.na(error )) %> %
504
- arrange(desc(time )) %> %
503
+ filter(! is.na(error )) %> %
505
504
distinct(error , .keep_all = TRUE ) %> %
506
- select (time , name , error )
505
+ slice_max (time , n = top_n )
507
506
508
507
# Print each error message, along with the parent target.
509
508
if (nrow(other_errors ) > 0 ) {
@@ -517,7 +516,7 @@ get_recent_targets_errors <- function(time_since = minutes(60)) {
517
516
}
518
517
}
519
518
520
- return (invisible (meta_df %> % filter (time > Sys.time() - time_since )))
519
+ return (invisible (meta_df %> % slice_max (time , n = top_n )))
521
520
}
522
521
523
522
# ' Retry a function.
0 commit comments