-
Notifications
You must be signed in to change notification settings - Fork 151
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
'Blob.exists()' does not work within batch context #31
Comments
@ludwigschubert Under the covers, |
To be clear: when this was moved to "feature request" by @frankyn , the implied statement is: there is no way to use blob.exists() within a batch context Is this correct? Thanks! |
For @ludwigschubert and those who arrive via Google. I found a simple fix for this: wrap each call for blob.exists() in a try/catch.
Of course, there are two layers of abstraction above which are not expressly necessary, but I've copy-pasted my internal code that handles the parallelization for all the cloud client functions. Feel free to comment or DM me for more information as necessary. Cheers. |
Possible implementation at googleapis/google-cloud-python#8618 |
Thank you folks for providing above workarounds! The current batch design does not support library methods whose return values depend on the response payload. In this case, the error handling and conversion in However, note that a new In addition, we've also added clarifications on the limited Batch support in the python client, see details in #1045 |
The
Blob.exists()
method does not work when run within a Batch context. The normal behavior ofexists()
is to return True unless aNotFound
exception occurs. Within the Batch context the exception seems to be suppressed and the function returns True. After leaving the Batch context, an Exception is then thrown.This is how I expected to be able to use the
exists()
function:Without the
Batch
contextmanager this code works, if inefficiently. With theBatch
contextmanager the code returns allTrue
s and throws an exception when leaving the context.This behavior seems unintuitive to me. Please let me know if the API is meant to be used differently. If it is meant to be used as in the provided code sample, I'd be happy to attempt a fix if one of the maintainers could point me in the right direction.
Environment configuration just in case:
The text was updated successfully, but these errors were encountered: