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 11, 2024
1 parent 1752b7c commit 4c0abfd
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 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
5 changes: 4 additions & 1 deletion 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

0 comments on commit 4c0abfd

Please sign in to comment.