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

Add helpful error message if user does not have access to S3 bucket #16

Open
micahjsmith opened this issue May 11, 2020 · 1 comment
Open
Milestone

Comments

@micahjsmith
Copy link
Contributor

If the user tries to download from S3 bucket but they do not have permission to access the request object, the error message should provide details about the permissions needed and how to request them.

Suggested message:

You don't have permission to access this task. For more details about requesting access to the ML Bazaar Task Suite, see https://mlbazaar.github.io/#how-can-i-request-access-to-the-datasets. If you think you should already have access to this task, make sure you have configured your AWS credentials correctly.
@csala csala modified the milestones: 0.2.2, 0.2.3 May 30, 2020
@micahjsmith
Copy link
Contributor Author

For our reference, here is the traceback when the user tries to access a dataset with permission:

$ python
Python 3.7.7 (default, Jul 20 2020, 16:35:32) 
[Clang 11.0.3 (clang-1103.0.32.62)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from mit_d3m import load_dataset
>>> 
>>> dataset = load_dataset('124_188_usps')
Downloading dataset from s3://d3m-data-dai
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/micahsmith/workspace/sandbox/.venv/lib/python3.7/site-packages/mit_d3m/__init__.py", line 144, in load_dataset
    d3mds = load_d3mds(dataset, root=root, force_download=force_download)
  File "/Users/micahsmith/workspace/sandbox/.venv/lib/python3.7/site-packages/mit_d3m/__init__.py", line 113, in load_d3mds
    download_dataset(BUCKET, dataset_key, dataset_tarfile)
  File "/Users/micahsmith/workspace/sandbox/.venv/lib/python3.7/site-packages/mit_d3m/__init__.py", line 64, in download_dataset
    client.download_file(Bucket=bucket, Key=key, Filename=filename)
  File "/Users/micahsmith/workspace/sandbox/.venv/lib/python3.7/site-packages/boto3/s3/inject.py", line 172, in download_file
    extra_args=ExtraArgs, callback=Callback)
  File "/Users/micahsmith/workspace/sandbox/.venv/lib/python3.7/site-packages/boto3/s3/transfer.py", line 307, in download_file
    future.result()
  File "/Users/micahsmith/workspace/sandbox/.venv/lib/python3.7/site-packages/s3transfer/futures.py", line 106, in result
    return self._coordinator.result()
  File "/Users/micahsmith/workspace/sandbox/.venv/lib/python3.7/site-packages/s3transfer/futures.py", line 265, in result
    raise self._exception
  File "/Users/micahsmith/workspace/sandbox/.venv/lib/python3.7/site-packages/s3transfer/tasks.py", line 255, in _main
    self._submit(transfer_future=transfer_future, **kwargs)
  File "/Users/micahsmith/workspace/sandbox/.venv/lib/python3.7/site-packages/s3transfer/download.py", line 343, in _submit
    **transfer_future.meta.call_args.extra_args
  File "/Users/micahsmith/workspace/sandbox/.venv/lib/python3.7/site-packages/botocore/client.py", line 357, in _api_call
    return self._make_api_call(operation_name, kwargs)
  File "/Users/micahsmith/workspace/sandbox/.venv/lib/python3.7/site-packages/botocore/client.py", line 676, in _make_api_call
    raise error_class(parsed_response, operation_name)
botocore.exceptions.ClientError: An error occurred (403) when calling the HeadObject operation: Forbidden

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