Skip to content
This repository has been archived by the owner on Apr 27, 2021. It is now read-only.

Commit

Permalink
Upgrade to dcp-cli (aka hca) version 6.4.0 (#91)
Browse files Browse the repository at this point in the history
  • Loading branch information
hannes-ucsc committed Nov 14, 2019
1 parent e2ae3ad commit 8fb3128
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 29 deletions.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
# Not using tests_require because that installs the test requirements into .eggs, not the virtualenv
extras_require={
"dss": [
'hca == 5.2.0',
'hca == 6.4.0',
'urllib3 >= 1.23',
'requests >= 2.19.1'
],
Expand Down
17 changes: 6 additions & 11 deletions src/humancellatlas/data/metadata/helpers/dss.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,19 +73,14 @@ def download_bundle_metadata(client: DSSClient,
replica=replica,
directurls=directurls,
presignedurls=presignedurls)
url = None
manifest = []
while True:
# We can't use get_file.iterate because it only returns the `bundle.files` part of the response and swallows
# the `bundle.version`. See https://github.com/HumanCellAtlas/dcp-cli/issues/331
# noinspection PyUnresolvedReferences,PyProtectedMember
response = client.get_bundle._request(kwargs, url=url)
bundle = response.json()['bundle']

bundle = None
# noinspection PyUnresolvedReferences
for page in client.get_bundle.paginate(**kwargs):
bundle = page['bundle']
manifest.extend(bundle['files'])
try:
url = response.links['next']['url']
except KeyError:
break
assert bundle is not None

metadata_files = {f['name']: f for f in manifest if f['indexed']}

Expand Down
33 changes: 16 additions & 17 deletions test/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,24 +180,23 @@ def _load_bundle(self, uuid, version, replica='aws', deployment='prod'):
return manifest, metadata_files

def _mock_get_bundle(self, file_uuid, file_version, content_type):
response = Mock()
response.links = {}
response.json.return_value = {
'bundle': {
'version': '2018-09-20T232924.687620Z',
'files': [
{
'name': 'name.json',
'uuid': file_uuid,
'version': file_version,
'indexed': True,
'content-type': content_type
}
]
}
}
client = Mock()
client.get_bundle._request.return_value = response
client.get_bundle.paginate.return_value = [
{
'bundle': {
'version': '2018-09-20T232924.687620Z',
'files': [
{
'name': 'name.json',
'uuid': file_uuid,
'version': file_version,
'indexed': True,
'content-type': content_type
}
]
}
}
]
return client

def test_bad_content(self):
Expand Down

0 comments on commit 8fb3128

Please sign in to comment.