@@ -479,14 +479,13 @@ sort_by_quantile <- function(forecasts) {
479
479
480
480
481
481
# ' Print recent targets errors.
482
- get_recent_targets_errors <- function (time_since = minutes( 60 ) ) {
483
- 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 )
484
484
forecast_errors <- meta_df %> %
485
- filter(time > Sys.time() - time_since , ! is.na(parent ), ! is.na(error )) %> %
486
- arrange(desc(time )) %> %
485
+ filter(! is.na(parent ), ! is.na(error )) %> %
487
486
distinct(parent , error , .keep_all = TRUE ) %> %
488
- select( time , parent , error ) %> %
489
- mutate( parent = gsub( " forecast_ " , " " , parent ) )
487
+ mutate( parent = gsub( " forecast_ " , " " , parent ) ) %> %
488
+ slice_max( time , n = top_n )
490
489
491
490
# Print each error message, along with the parent target.
492
491
if (nrow(forecast_errors ) > 0 ) {
@@ -501,10 +500,9 @@ get_recent_targets_errors <- function(time_since = minutes(60)) {
501
500
}
502
501
503
502
other_errors <- meta_df %> %
504
- filter(time > Sys.time() - time_since , ! is.na(error )) %> %
505
- arrange(desc(time )) %> %
503
+ filter(! is.na(error )) %> %
506
504
distinct(error , .keep_all = TRUE ) %> %
507
- select (time , name , error )
505
+ slice_max (time , n = top_n )
508
506
509
507
# Print each error message, along with the parent target.
510
508
if (nrow(other_errors ) > 0 ) {
@@ -518,7 +516,7 @@ get_recent_targets_errors <- function(time_since = minutes(60)) {
518
516
}
519
517
}
520
518
521
- return (invisible (meta_df %> % filter (time > Sys.time() - time_since )))
519
+ return (invisible (meta_df %> % slice_max (time , n = top_n )))
522
520
}
523
521
524
522
# ' Retry a function.
0 commit comments