zipline icon indicating copy to clipboard operation
zipline copied to clipboard

Bundle file for quatopian-quandl bundle not retrievable from S3

Open gohanlon opened this issue 9 years ago • 4 comments

Dear Zipline Maintainers,

Before I describe my environment, let me succinctly summarize both the issue and what appears to be the root cause of this issue in a way that's independent of my environment:

~ % curl https://s3.amazonaws.com/quantopian-public-zipline-data/quandl
<?xml version="1.0" encoding="UTF-8"?>
<Error><Code>AccessDenied</Code><Message>Access Denied</Message><RequestId>EA20B0B4671FD7DB</RequestId><HostId>sMkDQj9bABUgMSH4enVSvcHUM/FNHOKiBt7ORl73Wi34tT6zeiQgt5AMP/cgZvowBqafhNsuJak=</HostId></Error>%     ~ %

Where the URL being cURL'd above is the value of QUANTOPIAN_QUANDL_URL.

Now, let me describe my environment:

Environment

  • Operating System:
zipline master % uname -a
Darwin Galen-MBP-2016 16.4.0 Darwin Kernel Version 16.4.0: Thu Dec 22 22:53:21 PST 2016; root:xnu-3789.41.3~3/RELEASE_X86_64 x86_64
  • Python Version: $ python --version
zipline master % python --version
Python 2.7.13
  • Python Bitness: $ python -c 'import math, sys;print(int(math.log(sys.maxsize + 1, 2) + 1))'
zipline master % python -c 'import math, sys;print(int(math.log(sys.maxsize + 1, 2) + 1))'
64
  • How did you install Zipline: (pip, conda, or other (please explain))

Pip installed from master branch.

  • Python packages:
zipline master % pip freeze
alabaster==0.7.6
alembic==0.7.7
appdirs==1.4.3
Babel==1.3
backports.ssl-match-hostname==3.4.0.2
bcolz==0.12.1
Bottleneck==1.0.0
certifi==2015.4.28
click==4.0
contextlib2==0.4.0
cookies==2.2.1
coverage==4.0.3
coveralls==1.1
cyordereddict==0.2.2
Cython==0.25.2
decorator==4.0.0
docopt==0.6.2
docutils==0.12
empyrical==0.2.2
flake8==2.4.1
funcsigs==1.0.2
futures==3.0.5
intervaltree==2.1.0
Jinja2==2.7.3
Logbook==0.12.5
lru-dict==1.1.4
Mako==1.0.1
Markdown==2.6.2
MarkupSafe==0.23
mccabe==0.3.1
mistune==0.7
mock==2.0.0
multipledispatch==0.4.8
networkx==1.9.1
nose==1.3.7
nose-ignore-docstring==0.2
nose-parameterized==0.5.0
nose-timer==0.5.0
numexpr==2.6.1
numpy==1.11.1
numpydoc==0.5
packaging==16.8
pandas==0.18.1
pandas-datareader==0.2.1
patsy==0.4.0
pbr==1.10.0
pep8==1.5.7
piprot==0.9.6
pyandoc==0.0.1
pyflakes==0.8.1
Pygments==2.0.2
pyparsing==2.0.3
python-dateutil==2.4.2
pytz==2016.4
requests==2.9.1
requests-file==1.4.1
requests-futures==0.9.7
responses==0.4.0
scipy==0.17.1
six==1.10.0
snowballstemmer==1.2.0
sortedcontainers==1.4.4
Sphinx==1.3.4
sphinx-rtd-theme==0.1.8
SQLAlchemy==1.0.8
statsmodels==0.6.1
tables==3.3.0
termcolor==1.1.0
testfixtures==4.1.2
toolz==0.8.2
tornado==4.2.1
xlrd==0.9.4
zipline==1.1.0+39.ga006b4bb.dirty

Now that you know a little about me, let me tell you about the issue I am having:

Description of Issue

Expected to be able to load data from "quantopian-quandl" bundle, but failed with HTTP 403 Access Denied.

Here is how you can reproduce this issue on your machine:

Reproduction Steps

zipline master % zipline ingest -b quantopian-quandl
Traceback (most recent call last):
  File "/Users/gohanlon/.pyenv/versions/zipline-dev/bin/zipline", line 11, in <module>
    load_entry_point('zipline==1.1.0+39.ga006b4bb.dirty', 'console_scripts', 'zipline')()
  File "/Users/gohanlon/.pyenv/versions/2.7.13/envs/zipline-dev/lib/python2.7/site-packages/click/core.py", line 664, in __call__
    return self.main(*args, **kwargs)
  File "/Users/gohanlon/.pyenv/versions/2.7.13/envs/zipline-dev/lib/python2.7/site-packages/click/core.py", line 644, in main
    rv = self.invoke(ctx)
  File "/Users/gohanlon/.pyenv/versions/2.7.13/envs/zipline-dev/lib/python2.7/site-packages/click/core.py", line 991, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/Users/gohanlon/.pyenv/versions/2.7.13/envs/zipline-dev/lib/python2.7/site-packages/click/core.py", line 837, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/Users/gohanlon/.pyenv/versions/2.7.13/envs/zipline-dev/lib/python2.7/site-packages/click/core.py", line 464, in invoke
    return callback(*args, **kwargs)
  File "/Users/gohanlon/.pyenv/versions/2.7.13/envs/zipline-dev/lib/python2.7/site-packages/zipline/__main__.py", line 312, in ingest
    show_progress,
  File "/Users/gohanlon/.pyenv/versions/2.7.13/envs/zipline-dev/lib/python2.7/site-packages/zipline/data/bundles/core.py", line 451, in ingest
    pth.data_path([name, timestr], environ=environ),
  File "/Users/gohanlon/.pyenv/versions/2.7.13/envs/zipline-dev/lib/python2.7/site-packages/zipline/data/bundles/quandl.py", line 398, in quantopian_quandl_bundle
    label="Downloading Bundle: quantopian-quandl",
  File "/Users/gohanlon/.pyenv/versions/2.7.13/envs/zipline-dev/lib/python2.7/site-packages/zipline/data/bundles/quandl.py", line 344, in download_with_progress
    resp.raise_for_status()
  File "/Users/gohanlon/.pyenv/versions/2.7.13/envs/zipline-dev/lib/python2.7/site-packages/requests/models.py", line 840, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 403 Client Error: Forbidden for url: https://s3.amazonaws.com/quantopian-public-zipline-data/quandl

But, can be reduced to the bundle URL being inaccessible:

~ % curl https://s3.amazonaws.com/quantopian-public-zipline-data/quandl
<?xml version="1.0" encoding="UTF-8"?>
<Error><Code>AccessDenied</Code><Message>Access Denied</Message><RequestId>EA20B0B4671FD7DB</RequestId><HostId>sMkDQj9bABUgMSH4enVSvcHUM/FNHOKiBt7ORl73Wi34tT6zeiQgt5AMP/cgZvowBqafhNsuJak=</HostId></Error>%     ~ %

What steps have you taken to resolve this already?

None, other than reducing a test case to what seems to be the root cause.

gohanlon avatar Apr 03 '17 19:04 gohanlon

There is something broken in your file retrieval layer outside of the product

I saw this report across the weekend -- It worked in a Windows (10) environment with 'wget', and also with wget it worked for me directly, under Linux (CentOS 7, updated to current) -- checking again today it still works with 'curl'

$ curl -o quandl-tar -# https://s3.amazonaws.com/quantopian-public-zipline-data/quandl ######################################################################## 100.0% [herrold@centos-7 quandl]$ file quandl-tar quandl-tar: gzip compressed data, was "/tmp/zipline_bundle.tar", last modified: Mon Apr 3 01:31:25 2017, max compression [herrold@centos-7 quandl]$ md5sum quandl-tar 5bfa7f0c465223f8933d6688750afdf9 quandl-tar [herrold@centos-7 quandl]$

and in my OS/X environment, as well mini2013:temp herrold$ time curl -o quandl-tar -# https://s3.amazonaws.com/quantopian-public-zipline-data/quandl ######################################################################## 100.0%

real 3m38.407s user 0m3.000s sys 0m6.642s mini2013:temp herrold$ uname -a Darwin mini2013.first.owlriver.net 16.4.0 Darwin Kernel Version 16.4.0: Thu Dec 22 22:53:21 PST 2016; root:xnu-3789.41.3~3/RELmini2013:temp herrold$ time curl -o quandl-tar -# https://s3.amazonaws.com/quantopian-public-zipline-data/quandl ######################################################################## 100.0%

real 3m38.407s user 0m3.000s sys 0m6.642s mini2013:temp herrold$ uname -a Darwin mini2013.first.owlriver.net 16.4.0 Darwin Kernel Version 16.4.0: Thu Dec 22 22:53:21 PST 2016; mini2013:temp herrold$ md5 quandl-tar MD5 (quandl-tar) = 5bfa7f0c465223f8933d6688750afdf9 mini2013:temp herrold$ ls -al quandl-tar -rw-r--r-- 1 herrold staff 143555167 Apr 3 15:51 quandl-tar mini2013:temp herrold$

herrold avatar Apr 03 '17 19:04 herrold

Hi @gohanlon and @herrold ,

Something's gone awry with the configuration of our internal job that updates that file. I'm investigating now.

In the meantime I've (twice, now) manually changed the permissions back to Public-Readable to work around it.

I'm going to leave this issue open until the root cause is sorted out. Thanks for reporting it to our attention!

jdricklefs avatar Apr 03 '17 19:04 jdricklefs

We've fixed the problems with the permissions on the file-generating job, so this should be fixed for good now. Thanks everyone for your patience!

jdricklefs avatar Apr 03 '17 21:04 jdricklefs

@jdricklefs Awesome! As you'd expect, I'm now able to curl the file and zipline ingest -b quantopian-quandl works perfectly. And, I'll update this issue if I notice that the file permissions have reverted to something less than "public-readable". Thanks!

gohanlon avatar Apr 03 '17 22:04 gohanlon