From 83b6376edd0997e1e72752e276c23a2bae6b20dd Mon Sep 17 00:00:00 2001 From: DerekFurstPitt Date: Wed, 18 Feb 2026 11:48:13 -0500 Subject: [PATCH] fixed a potential bug in hubmap_translator that causes target entities to not enqueue properly if they're collections/epicollections/uploads --- src/hubmap_translator.py | 52 +++++++++++++++++++--------------------- 1 file changed, 25 insertions(+), 27 deletions(-) diff --git a/src/hubmap_translator.py b/src/hubmap_translator.py index 1170a11d..e0a6af29 100644 --- a/src/hubmap_translator.py +++ b/src/hubmap_translator.py @@ -712,6 +712,13 @@ def enqueue_reindex(self, entity_id, reindex_queue, priority): ) collection_associations = [] upload_associations = [] + previous_revision_ids = [] + next_revision_ids = [] + neo4j_collection_ids = [] + neo4j_upload_ids = [] + neo4j_ancestor_ids = [] + neo4j_descendant_ids = [] + if entity['entity_type'] in ['Collection', 'Epicollection']: collection = self.get_collection_doc(entity_id=entity_id) if 'datasets' in collection: @@ -722,38 +729,29 @@ def enqueue_reindex(self, entity_id, reindex_queue, priority): if 'associated_publication' in collection and collection['associated_publication']: logger.info(f"Enqueueing associated_publication for {entity['entity_type']} {entity_id}") collection_associations.append(collection['associated_publication']) - - logger.info(f"Finished executing enqueue_reindex() for {entity['entity_type']} of uuid: {entity_id}") - return job_id - if entity['entity_type'] == 'Upload': + elif entity['entity_type'] == 'Upload': if 'datasets' in entity: logger.info(f"Enqueueing {len(entity['datasets'])} datasets for Upload {entity_id}") for dataset in entity['datasets']: upload_associations.append(dataset['uuid']) - logger.info(f"Finished executing enqueue_reindex() for Upload of uuid: {entity_id}") - return job_id - - logger.info(f"Calculating related entities for {entity_id}") - - neo4j_ancestor_ids = self.call_entity_api( - entity_id=entity_id, - endpoint_base='ancestors', - endpoint_suffix=None, - url_property='uuid' - ) - - neo4j_descendant_ids = self.call_entity_api( - entity_id=entity_id, - endpoint_base='descendants', - endpoint_suffix=None, - url_property='uuid' - ) - - previous_revision_ids = [] - next_revision_ids = [] - neo4j_collection_ids = [] - neo4j_upload_ids = [] + + else: + logger.info(f"Calculating related entities for {entity_id}") + + neo4j_ancestor_ids = self.call_entity_api( + entity_id=entity_id, + endpoint_base='ancestors', + endpoint_suffix=None, + url_property='uuid' + ) + + neo4j_descendant_ids = self.call_entity_api( + entity_id=entity_id, + endpoint_base='descendants', + endpoint_suffix=None, + url_property='uuid' + ) if entity['entity_type'] in ['Dataset', 'Publication']: previous_revision_ids = self.call_entity_api(