Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Command bqr_download_extract fails in 0.5.0 when downloading from extract job that produced multiple files #79

Open
kdw2126 opened this issue May 24, 2022 · 2 comments

Comments

@kdw2126
Copy link

kdw2126 commented May 24, 2022

Whenever I run the bqr_download_extract command in 0.5.0, I get the following output:

>     bqr_download_extract(bqr_get_job(jobId=job_extract,projectId=projectId))
Multiple files to download.
ℹ 2022-05-24 14:09:18 > Request Status Code:  404
Error in `abort_http()`:
! http_404 Unspecified error
Run `rlang::last_error()` to see where the error occurred.
✖ Downloading 1 ... failed

Looking at the traceback and the log, the issue seems to be that the bqr_download_extract command is trying to download a file named "1" rather than a file with the appropriate name.

Looking through the code, this line seems to be the culprit:

  if(length(objectnames) > 1){
    message("Multiple files to download.")
    filename <- paste0(as.character(1:length(objectnames),"_",filename))
  }

In cases where there are multiple files (length of object names > 1), then this is assigning the filename to equal a list of numerical strings the length of objectnames. In the case of my machines, if there are three files that it is looking to download, 1:length(objectnames) produces a list [1, 2, 3] and as.character transforms this list to "1" "2" "3". This is why the error messages mentions failing to find file 1. When I replace the logic to set filename equal to objectnames instead of paste0(as.character(1:length(objectnames),"_",filename)), the code works as expected.

Let me know if you need more information to troubleshoot. I haven't used R in a while so I might have missed something obvious, although this error has occurred on multiple machines that members of my team have used.

@kdw2126 kdw2126 changed the title Command bqr_download_extract fails in 0.5.0 when downloading from extract job producing multiple files Command bqr_download_extract fails in 0.5.0 when downloading from extract job that produced multiple files May 24, 2022
@MarkEdmondson1234
Copy link
Collaborator

Thank you it looks like your analysis is correct - do you have a likely fix I can start from?

@kdw2126
Copy link
Author

kdw2126 commented May 25, 2022

If you delete the filename <- paste0(as.character(1:length(objectnames),"_",filename)) command and replace with filename <- objectnames, the command worked as I expected. (You may not even need that line because several lines up the same operation is performed, but I haven't tested all the possible edge cases.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants