-
Notifications
You must be signed in to change notification settings - Fork 6
Enable referential integrity checking within perform_mongo_updates op
#1174
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Enable referential integrity checking within perform_mongo_updates op
#1174
Conversation
|
I'm still a little confused about how Dagster things get defined. I'm trying to determine whether I see that |
The string "metadata-in-1.0.0" represents (or was intended to represent) a specific (versioned) NMDC workflow, like something run on NERSC. "apply_metadata_in" represents a dagster job. The |
|
Thanks, @dwinston. Because the function can do updates, I don't think the solution I've implemented in this PR will suffice. It covers insertions, but not updates. For example: if the caller wants to update an existing document (matched by its There is a function that can be used to check referential integrity in this case (it uses a MongoDB transaction to do the writes, check references, and then roll back the writes), but it it not what I did here and may complicate this function enough that we defer adding referential integrity checking to this function until after Q4 ends (which was always an option for the three referential integrity-related tickets on the squad board). I'll think about this more next week, and we can discuss it at the next squad meeting. |
On this branch, I added real-time referential checking to the
apply_metadata_inDagster graph.Details
Specifically, I:
check_inter_document_references=Truekwarg to a call tovalidate_json()so that theapply_metadata_inDagster graph performs referential integrity checking (in addition to the schema validation it already performed).test_apply_metadata_in_functional_annotation_aggtest so that the document referenced by the documents the test inserts via the Dagster op, exists. That way, the insertion does not fail due to the newly-introduced referential integrity check.test_apply_metadata_in_checks_referential_integrity, which demonstrates that, when a document being inserted via the Dagster op includes a broken reference, the document does not get inserted.TODOs about documenting undocumented functions.The generically-named
perform_mongo_updatesfunction is only called by theapply_metadata_ingraph.Related issue(s)
Fixes #969
Related subsystem(s)
docsdirectory)Testing
I tested these changes by...
Documentation
docsdirectory)Maintainability
study_id: str)# TODOor# FIXMEblackto format all the Python files I created/modified