It appears that the object returned by gcs.get_client() does not implement the enter method, which means it's not designed to be used as a context manager with the with statement.
When making an documented example, you recive an error:
@asset
def my_asset(gcs: GCSResource):
with gcs.get_client() as client:
# client is a google.cloud.storage.Client
pass
dagster._core.errors.DagsterExecutionStepExecutionError: Error occurred while executing op "my_asset"::
AttributeError: __enter__
Changing the code to client = gcs.get_client() makes it a usable resouce.
One should either change the documentaton or implement the context manager (but it seeems like the client is not designed by Google to be used as a context manager, as the documentation lack such examples).
Message from the maintainers
Impacted by this issue? Give it a 👍! We factor engagement into prioritization.
What's the issue or suggestion?
The example of usage of GCSResource does not seem to work, as the GCP Storage Client is not intened to be used as a context manager.
https://docs.dagster.io/_apidocs/libraries/dagster-gcp#gcs-resource
Additional information
Dagster version: 1.5.5
It appears that the object returned by
gcs.get_client()
does not implement the enter method, which means it's not designed to be used as a context manager with the with statement.When making an documented example, you recive an error:
Changing the code to
client = gcs.get_client()
makes it a usable resouce.One should either change the documentaton or implement the context manager (but it seeems like the client is not designed by Google to be used as a context manager, as the documentation lack such examples).
Message from the maintainers
Impacted by this issue? Give it a 👍! We factor engagement into prioritization.