Skip to content

Commit

Permalink
fixup! Add JSONL-based verbatim manifest format (#6028)
Browse files Browse the repository at this point in the history
  • Loading branch information
nadove-ucsc committed Mar 23, 2024
1 parent 9cca15d commit 924805f
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
5 changes: 4 additions & 1 deletion src/azul/plugins/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,10 @@ def source_id_field(self) -> str:
def implicit_hub_type(self) -> str:
"""
The type of entities that do not explicitly track their hubs in replica
documents.
documents in order to avoid a large list of hub references in the
replica document, and to avoid contention when updating that list during
indexing. Note that this is not a type of hub entities, but rather the
type of replica entities that have implicit hubs.
"""
raise NotImplementedError

Expand Down
2 changes: 1 addition & 1 deletion src/azul/service/manifest_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -2096,7 +2096,7 @@ def _join_replicas(self, keys: Iterable[ReplicaKeys]) -> Iterable[Hit]:
return request.scan()

def create_file(self) -> tuple[str, Optional[str]]:
fd, path = mkstemp()
fd, path = mkstemp(suffix=f'.{self.file_name_extension()}')
os.close(fd)
with open(path, 'w') as f:
for replica in self._all_replicas():
Expand Down
10 changes: 5 additions & 5 deletions test/service/test_manifest.py
Original file line number Diff line number Diff line change
Expand Up @@ -1278,7 +1278,7 @@ def test_manifest_content_disposition_header(self):
@manifest_test
def test_verbatim_jsonl_manifest(self):
bundle = self._load_canned_bundle(one(self.bundles()))
expected_contents = [
expected = [
bundle.metadata_files[d]
for d in [
'cell_suspension_0.json',
Expand All @@ -1290,14 +1290,14 @@ def test_verbatim_jsonl_manifest(self):
]
response = self._get_manifest(ManifestFormat.verbatim_jsonl, {})
self.assertEqual(200, response.status_code)
response_contents = list(map(json.loads, response.content.decode().splitlines()))
response = list(map(json.loads, response.content.decode().splitlines()))

def sort_key(hca_doc: JSON) -> str:
return hca_doc['provenance']['document_id']

expected_contents.sort(key=sort_key)
response_contents.sort(key=sort_key)
self.assertEqual(expected_contents, response_contents)
expected.sort(key=sort_key)
response.sort(key=sort_key)
self.assertEqual(expected, response)


class TestManifestCache(ManifestTestCase):
Expand Down

0 comments on commit 924805f

Please sign in to comment.