ropensci / piggyback

:package: for using large(r) data files on GitHub
https://docs.ropensci.org/piggyback
GNU General Public License v3.0
185 stars 26 forks source link

Random error when using pb_upload() #101

Closed PMassicotte closed 1 year ago

PMassicotte commented 1 year ago

I am using this code to create a file to upload:

library(piggyback)

tmpfile <- tempfile(fileext = ".csv")
write.csv(mtcars, tmpfile)

Then I am trying to upload it. The tag 1.1.4 does not exists, so it asks me to create it and then, this time, worked fine.

r$>   pb_upload(tmpfile, overwrite = TRUE, tag = "v1.1.4")
! Release "v1.1.4" not found in "PMassicotte/learn-piggyback".
Would you like to create a new release now? 

1: Yes
2: No

Selection: 1
✔ Created new release "v1.1.4".
ℹ Uploading file1a5c725e22bce3.csv ...
  |===============================================================| 100%

The exact same code, but with a new tag (v.1.1.6) I am getting an error:

r$> NvimR.paragraph(echo=TRUE)
r$>   pb_upload(tmpfile, overwrite = TRUE, tag = "v1.1.6")
! Release "v1.1.6" not found in "PMassicotte/learn-piggyback".
Would you like to create a new release now? 

1: Yes
2: No

Selection: 1
✔ Created new release "v1.1.6".
ℹ Uploading file1a5c725e22bce3.csv ...
Error in parse_url(url) : length(url) == 1 is not TRUE
r$> sessionInfo()
R version 4.3.1 (2023-06-16)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Linux Mint 21.1

Matrix products: default
BLAS/LAPACK: /opt/intel/compilers_and_libraries_2020.4.304/linux/mkl/lib/
intel64_lin/libmkl_gf_lp64.so;  LAPACK version 3.8.0

locale:
 [1] LC_CTYPE=en_CA.UTF-8       LC_NUMERIC=C              
 [3] LC_TIME=en_CA.UTF-8        LC_COLLATE=en_CA.UTF-8    
 [5] LC_MONETARY=en_CA.UTF-8    LC_MESSAGES=en_CA.UTF-8   
 [7] LC_PAPER=en_CA.UTF-8       LC_NAME=C                 
 [9] LC_ADDRESS=C               LC_TELEPHONE=C            
[11] LC_MEASUREMENT=en_CA.UTF-8 LC_IDENTIFICATION=C       

time zone: America/Montreal
tzcode source: system (glibc)

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] piggyback_0.1.4 nvimcom_0.9-146

loaded via a namespace (and not attached):
 [1] R6_2.5.1         lubridate_1.9.2  gh_1.4.0         fastmap_1.1.1   
 [5] magrittr_2.0.3   rappdirs_0.3.3   cachem_1.0.8     glue_1.6.2      
 [9] ini_0.3.1        memoise_2.0.1    gitcreds_0.1.2   timechange_0.2.0
[13] generics_0.1.3   cli_3.6.1        compiler_4.3.1   httr_1.4.6      
[17] tools_4.3.1      curl_5.0.1       mime_0.12        httr2_0.2.3     
[21] rlang_1.1.1      jsonlite_1.8.5   fs_1.6.2       
tanho63 commented 1 year ago

Hmm, and does the problem persist with the development version from GitHub? I believe that's on 0.1.4.9006

PMassicotte commented 1 year ago

Getting the same message, first time running pb_upload() on a new tag fails. Re-runing the command (i.e. on the same tag) right after works. So it fails when the tag does not exist and need to be created, but will work the second time.

tanho63 commented 1 year ago

I think this is a GitHub latency issue where it takes a second or two to recognize that the new release is available - I turned off all the caching etc and still reproduced the problem, so I added a Sys.sleep(2) and I think that resolves the issue. Should be resolved when #103 merges in

PMassicotte commented 1 year ago

Thank you @tanho63 for this.