Skip to content

Commit

Permalink
Include replica_type in JSONL manifest
Browse files Browse the repository at this point in the history
  • Loading branch information
nadove-ucsc committed Apr 12, 2024
1 parent 6fa9d98 commit b18acc2
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
8 changes: 6 additions & 2 deletions src/azul/service/manifest_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -2067,7 +2067,7 @@ def _all_replicas(self) -> Iterable[JSON]:
replica_id = replica.meta.id
if replica_id not in emitted_replica_ids:
num_new_replicas += 1
yield replica.contents.to_dict()
yield replica.to_dict()
# Note that this will be zero for replicas that use implicit
# hubs, in which case there are actually many hubs
explicit_hub_count = len(replica.hub_ids)
Expand Down Expand Up @@ -2113,6 +2113,10 @@ def create_file(self) -> tuple[str, Optional[str]]:
os.close(fd)
with open(path, 'w') as f:
for replica in self._all_replicas():
json.dump(replica, f)
entry = {
'contents': replica['contents'],
'type': replica['replica_type']
}
json.dump(entry, f)
f.write('\n')
return path, None
7 changes: 5 additions & 2 deletions test/service/test_manifest.py
Original file line number Diff line number Diff line change
Expand Up @@ -1306,7 +1306,10 @@ def test_verbatim_jsonl_manifest(self):
]
response = self._get_manifest(ManifestFormat.verbatim_jsonl, {})
self.assertEqual(200, response.status_code)
response = list(map(json.loads, response.content.decode().splitlines()))
response = [
json.loads(row)['contents']
for row in response.content.decode().splitlines()
]

def sort_key(hca_doc: JSON) -> str:
return hca_doc['provenance']['document_id']
Expand Down Expand Up @@ -2041,7 +2044,7 @@ def test_jsonl_manifest(self):
response = self._get_manifest(ManifestFormat.verbatim_jsonl, filters={})
self.assertEqual(200, response.status_code)
manifest = [
json.loads(row)
json.loads(row)['contents']
for row in response.content.decode().splitlines()
]
expected = [
Expand Down

0 comments on commit b18acc2

Please sign in to comment.