Coder Social home page Coder Social logo

problem with s3 delete_objects about paws HOT 8 CLOSED

dleopold avatar dleopold commented on August 16, 2024
problem with s3 delete_objects

from paws.

Comments (8)

dleopold avatar dleopold commented on August 16, 2024 1

It does seem to work with the Quiet parameter removed. Not sure how I failed to try that. Thank you. I will close the issue since it is resolved for me, though maybe a quick update to the docs would prevent others from running into the same issue. Also, s3fs looks promising!

from paws.

DyfanJones avatar DyfanJones commented on August 16, 2024 1

Happy to re-open this ticket.

from paws.

DyfanJones avatar DyfanJones commented on August 16, 2024 1

Ok I think I have fixed it:

remotes::install_github("dyfanjones/paws/paws.common", ref = "xml_build_flatten")
client <- paws.storage::s3()

bucket <- "mybucket"
key <- "removable.txt"

resp <- client$put_object(
  Bucket = bucket,
  Key = key,
  Body = charToRaw("dummy")
)

client$delete_objects(
  Bucket = bucket,
  Delete = list(
    Objects = list(
      list(Key = key)
    ),
    Quiet = T
  )
)
#> $Deleted
#> list()
#> 
#> $RequestCharged
#> character(0)
#> 
#> $Errors
#> list()

Created on 2023-11-08 with reprex v2.0.2

Session info
sessioninfo::session_info()
#> ─ Session info ───────────────────────────────────────────────────────────────
#>  setting  value
#>  version  R version 4.3.2 (2023-10-31)
#>  os       macOS Sonoma 14.0
#>  system   aarch64, darwin20
#>  ui       X11
#>  language (EN)
#>  collate  en_US.UTF-8
#>  ctype    en_US.UTF-8
#>  tz       Europe/London
#>  date     2023-11-08
#>  pandoc   3.1.9 @ /opt/homebrew/bin/ (via rmarkdown)
#> 
#> ─ Packages ───────────────────────────────────────────────────────────────────
#>  package      * version    date (UTC) lib source
#>  base64enc      0.1-3      2015-07-28 [1] CRAN (R 4.3.0)
#>  cli            3.6.1      2023-03-23 [1] CRAN (R 4.3.0)
#>  crayon         1.5.2      2022-09-29 [1] CRAN (R 4.3.0)
#>  curl           5.1.0      2023-10-02 [1] CRAN (R 4.3.1)
#>  digest         0.6.33     2023-07-07 [1] CRAN (R 4.3.0)
#>  evaluate       0.23       2023-11-01 [1] CRAN (R 4.3.1)
#>  fastmap        1.1.1      2023-02-24 [1] CRAN (R 4.3.0)
#>  fs             1.6.3      2023-07-20 [1] CRAN (R 4.3.0)
#>  glue           1.6.2      2022-02-24 [1] CRAN (R 4.3.0)
#>  htmltools      0.5.7      2023-11-03 [1] CRAN (R 4.3.1)
#>  httr           1.4.7      2023-08-15 [1] CRAN (R 4.3.0)
#>  knitr          1.45       2023-10-30 [1] CRAN (R 4.3.1)
#>  lifecycle      1.0.3      2022-10-07 [1] CRAN (R 4.3.0)
#>  magrittr       2.0.3      2022-03-30 [1] CRAN (R 4.3.0)
#>  mime           0.12       2021-09-28 [1] CRAN (R 4.3.0)
#>  paws.common    0.6.3.9000 2023-11-08 [1] Github (dyfanjones/paws@a7aaf4d)
#>  paws.storage   0.5.0      2023-11-02 [1] local (/Users/dyfanjones/Documents/Packages/paws/cran/paws.storage)
#>  purrr          1.0.2      2023-08-10 [1] CRAN (R 4.3.0)
#>  R.cache        0.16.0     2022-07-21 [1] CRAN (R 4.3.0)
#>  R.methodsS3    1.8.2      2022-06-13 [1] CRAN (R 4.3.0)
#>  R.oo           1.25.0     2022-06-12 [1] CRAN (R 4.3.0)
#>  R.utils        2.12.2     2022-11-11 [1] CRAN (R 4.3.0)
#>  R6             2.5.1      2021-08-19 [1] CRAN (R 4.3.0)
#>  Rcpp           1.0.11     2023-07-06 [1] CRAN (R 4.3.0)
#>  reprex         2.0.2      2022-08-17 [1] CRAN (R 4.3.0)
#>  rlang          1.1.1      2023-04-28 [1] CRAN (R 4.3.0)
#>  rmarkdown      2.25       2023-09-18 [1] CRAN (R 4.3.1)
#>  rstudioapi     0.15.0     2023-07-07 [1] CRAN (R 4.3.0)
#>  sessioninfo    1.2.2      2021-12-06 [1] CRAN (R 4.3.0)
#>  styler         1.10.2     2023-08-29 [1] CRAN (R 4.3.0)
#>  vctrs          0.6.4      2023-10-12 [1] CRAN (R 4.3.1)
#>  withr          2.5.2      2023-10-30 [1] CRAN (R 4.3.1)
#>  xfun           0.41       2023-11-01 [1] CRAN (R 4.3.1)
#>  xml2           1.3.5      2023-07-06 [1] CRAN (R 4.3.0)
#>  yaml           2.3.7      2023-01-23 [1] CRAN (R 4.3.0)
#> 
#>  [1] /Users/dyfanjones/Library/R/arm64/4.3/library
#>  [2] /Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/library
#> 
#> ──────────────────────────────────────────────────────────────────────────────

@wlandau @dleopold Please try it out and let me know :)

from paws.

DyfanJones avatar DyfanJones commented on August 16, 2024 1

paws.common 0.6.4 has been released to cran.

from paws.

DyfanJones avatar DyfanJones commented on August 16, 2024

Hi @dleopold sorry about that. Have you tried to delete objects without Quiet parameter?

svc$delete_objects(
  Bucket = "...",
  Delete = list(
    Objects = list(
      list(
        Key = "..."
      ),
      list(
        Key = "..."
      )
    )
  )
)

Here is an example of it working in the up and coming s3fs package https://github.com/DyfanJones/s3fs/blob/main/R/s3filesystem_class.R#L349-L362 .

Interesting I didn't realise this:

Also, FYI, I noticed that attempting to use either delete_object or delete_objects when the bucket is in a different region, the operation fails with an unhelpful error message:

Error in enc2utf8(data) : argument is not a character vector

I will have to have a look why this is the case 🤔

from paws.

wlandau avatar wlandau commented on August 16, 2024

I am hitting this issue too (working on ropensci/targets#1171) and it would be great to get Quiet = TRUE to work. Quiet mode sends a smaller HTTP response, so it could perform faster.

from paws.

wlandau avatar wlandau commented on August 16, 2024

Thanks so much, @DyfanJones! Works for me now!

from paws.

dleopold avatar dleopold commented on August 16, 2024

Works here. Thanks.

from paws.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.