scoa
scoa

Reputation: 19857

`targets::tar_prune()` looks for a target in NA bucket

In a targets project with AWS cloud storage, running tar_prune() returns an error because one of the target to delete apparently misses a proper bucket name:

Deleting 11 objects from AWS S3 bucket project_name /
Deleting 1 objects from AWS S3 bucket NA -
Error:
! Error running targets::tar_prune()

How can I fix this? I am guessing I need to first find the problematic target then fix its metadata but I am unsure how to do any of this.

Why it matters? Running tar_meta(fields = warnings, complete_only = TRUE) returns problems with no longer existing targets. tar_prune() should have removed the metadata associated with those.

I am sorry I cannot provide a reproducible example as I have no idea how to make this error appear again.

Upvotes: 1

Views: 32

Answers (1)

scoa
scoa

Reputation: 19857

I think I have solved the problem by editing the local file: _targets/meta/meta. I first looked into the file to find where the error was:

# read meta file
meta <- read_delim("_targets/meta/meta", delim="|")
# find where the problem is
filter(meta, name %in% tar_prune_list())

Returns:

# A tibble: 13 × 18
   name      type  data  command depend    seed path  time  size    bytes format repository iteration parent children seconds
   <chr>     <chr> <chr> <chr>   <chr>    <dbl> <chr> <chr> <chr>   <dbl> <chr>  <chr>      <chr>     <chr>  <chr>      <dbl>
4 genres_al… stem  "222… dae157… 3f860…  1.54e9 "buc… t198… ""    5.08e2 rds    aws        vector    ""     ""         0.369
5 genres_mu… stem  ""    71092c… 5784c… -1.61e9 ""    t199… ""    0      rds    aws        vector    ""     ""         0.012
                                                ^
                                                empty value

I then made a copy of the meta file for safety and edited it. I copied the path value of line 4 to line 5, and replaced the name of the target. It has the following format:

bucket=MYBUCKET*region=NULL*key=MYPROJECT/objects/TARGETNAME*endpoint=HASH*version=

I ran tar_prune() again with no error, and tar_meta() now returns the expected results.

Thanks to @defuneste for the suggestion to look into meta.

Upvotes: 1

Related Questions