hubmapconsortium / entity-api

A set of web service calls to return information about HuBMAP entities
https://entity.api.hubmapconsortium.org
MIT License
3 stars 1 forks source link

PUT call failed to execute trigger #603

Closed yuanzhou closed 10 months ago

yuanzhou commented 10 months ago

The ingest-ui on DEV made a PUT call against https://entity-api.dev.hubmapconsortium.org/entities/ce723f30e49cb26c655d24cb822d581f with the following payload

{"lab_dataset_id":"fghfh","contains_human_genetic_sequences":false,"dataset_type":"Histology","description":"dfhfdg","dataset_info":"dfghdfgh","ingest_task":"","direct_ancestor_uuids":["3b35cf69441e8f4e90ed5e57f5520aa7"]}

One trigger method failed to delete the existing relationship linkages.

[2024-01-23 20:41:47] ERROR in schema_manager: Failed to call the after_update_trigger method: link_dataset_to_direct_ancestors
Traceback (most recent call last):
  File "/usr/src/app/src/./schema/schema_manager.py", line 320, in generate_triggered_data
    trigger_method_to_call(key, normalized_class, user_token, existing_data_dict, {})
  File "/usr/src/app/src/./schema/schema_triggers.py", line 794, in link_dataset_to_direct_ancestors
    schema_neo4j_queries.link_entity_to_direct_ancestors(schema_manager.get_neo4j_driver_instance(), dataset_uuid, direct_ancestor_uuids, activity_data_dict)
  File "/usr/src/app/src/./schema/schema_neo4j_queries.py", line 540, in link_entity_to_direct_ancestors
    tx.commit()
  File "/usr/local/lib/python3.9/site-packages/neo4j/work/transaction.py", line 157, in commit
    self._connection.fetch_all()
  File "/usr/local/lib/python3.9/site-packages/neo4j/io/__init__.py", line 535, in fetch_all
    detail_delta, summary_delta = self.fetch_message()
  File "/usr/local/lib/python3.9/site-packages/neo4j/io/_bolt4.py", line 309, in fetch_message
    response.on_failure(summary_metadata or {})
  File "/usr/local/lib/python3.9/site-packages/neo4j/io/_common.py", line 228, in on_failure
    raise Neo4jError.hydrate(**metadata)
neo4j.exceptions.ConstraintError: {code: Neo.ClientError.Schema.ConstraintValidationFailed} {message: Cannot delete node<56995>, because it still has relationships. To delete this node, you must first delete its relationships.}
[2024-01-23 20:41:47] ERROR in app: The entity information has been updated, but failed to execute one of the 'after_update_trigger' methods
Traceback (most recent call last):
  File "/usr/src/app/src/./schema/schema_manager.py", line 320, in generate_triggered_data
    trigger_method_to_call(key, normalized_class, user_token, existing_data_dict, {})
  File "/usr/src/app/src/./schema/schema_triggers.py", line 794, in link_dataset_to_direct_ancestors
    schema_neo4j_queries.link_entity_to_direct_ancestors(schema_manager.get_neo4j_driver_instance(), dataset_uuid, direct_ancestor_uuids, activity_data_dict)
  File "/usr/src/app/src/./schema/schema_neo4j_queries.py", line 540, in link_entity_to_direct_ancestors
    tx.commit()
  File "/usr/local/lib/python3.9/site-packages/neo4j/work/transaction.py", line 157, in commit
    self._connection.fetch_all()
  File "/usr/local/lib/python3.9/site-packages/neo4j/io/__init__.py", line 535, in fetch_all
    detail_delta, summary_delta = self.fetch_message()
  File "/usr/local/lib/python3.9/site-packages/neo4j/io/_bolt4.py", line 309, in fetch_message
    response.on_failure(summary_metadata or {})
  File "/usr/local/lib/python3.9/site-packages/neo4j/io/_common.py", line 228, in on_failure
    raise Neo4jError.hydrate(**metadata)
neo4j.exceptions.ConstraintError: {code: Neo.ClientError.Schema.ConstraintValidationFailed} {message: Cannot delete node<56995>, because it still has relationships. To delete this node, you must first delete its relationships.}

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/src/app/src/./app.py", line 4528, in after_update
    schema_manager.generate_triggered_data('after_update_trigger', normalized_entity_type, user_token, entity_dict, {})
  File "/usr/src/app/src/./schema/schema_manager.py", line 329, in generate_triggered_data
    raise schema_errors.AfterUpdateTriggerException
schema.schema_errors.AfterUpdateTriggerException
[pid: 273|app: 0|req: 921738/1968484] 172.31.17.198 () {72 vars in 1331 bytes} [Tue Jan 23 20:41:46 2024] PUT /entities/ce723f30e49cb26c655d24cb822d581f => generated 144 bytes in 1344 msecs (HTTP/1.1 500)

Could it because this dataset is generated by Multi-Assay Split? Or anything related to the recent dataset_type updates if not already an existing issue on PROD?

yuanzhou commented 10 months ago

Addressed via https://github.com/hubmapconsortium/entity-api/pull/607