-
Notifications
You must be signed in to change notification settings - Fork 22
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
Track constraint checking #1013
Conversation
new file: merlin-server/sql/merlin/tables/constraint_run.sql new file: merlin-server/src/main/java/gov/nasa/jpl/aerie/merlin/server/remotes/ConstraintRepository.java new file: merlin-server/src/main/java/gov/nasa/jpl/aerie/merlin/server/remotes/postgres/ConstraintRunRecord.java new file: merlin-server/src/main/java/gov/nasa/jpl/aerie/merlin/server/remotes/postgres/CreateConstraintRunAction.java new file: merlin-server/src/main/java/gov/nasa/jpl/aerie/merlin/server/remotes/postgres/GetConstraintRunsAction.java new file: merlin-server/src/main/java/gov/nasa/jpl/aerie/merlin/server/remotes/postgres/InsertConstraintRunsAction.java new file: merlin-server/src/main/java/gov/nasa/jpl/aerie/merlin/server/remotes/postgres/PostgresConstraintRepository.java new file: merlin-server/src/main/java/gov/nasa/jpl/aerie/merlin/server/services/ConstraintAction.java new file: merlin-server/src/main/java/gov/nasa/jpl/aerie/merlin/server/services/ConstraintService.java new file: merlin-server/src/main/java/gov/nasa/jpl/aerie/merlin/server/services/LocalConstraintService.java new file: merlin-server/src/test/java/gov/nasa/jpl/aerie/merlin/server/mocks/StubConstraintService.java
8969a15
to
8fe0b14
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Works great! Tested with a couple constraints in the demo mission model. Created NASA-AMMOS/aerie-ui#770 to update the UI to use the new table. Good to go.
deployment/hasura/metadata/databases/AerieMerlin/tables/public_constraint_run.yaml
Show resolved
Hide resolved
merlin-server/src/main/java/gov/nasa/jpl/aerie/merlin/server/http/MerlinBindings.java
Show resolved
Hide resolved
merlin-server/src/main/java/gov/nasa/jpl/aerie/merlin/server/services/ConstraintAction.java
Outdated
Show resolved
Hide resolved
Thanks Chris! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Thanks Cody!
…taset to constraint run
Closes #997
Closes #514
Closes #637
Description
This PR adds constraint run tracking. The way it's currently working is each
constraint_run
record is tied to a constraint that was checked. Regardless on if that constraint had violations or not we save a record to theconstraint_run
table that includes basic constraint information and the violations that were encountered. This allows us to reuse those violations in subsequent constraint violation checks.There is also staleness checking for the runs through a field called
definition_outdated
. This field tracks if the constraint definition has changed since the violations were checked last.There is also staleness checking for the runs, each record gets the statusresolved
when it has been saved to the db. If the user makes a change to a constraint with anyresolved
runs, those affected runs get a status change toconstraint-outdated
. This works the same way for simulations, if a violation check happened and then the user runs a new simulation all constraint runs for that previous dataset are marked assimulation-outdated
.This is my first big PR for
aerie-merlin
so please hit me with some feedback!Verification
Manual tests, I need to work on adding some real tests but I wanted to get the PR up for review first. Expect another commit with tests.
To verify everything is working properly you can do the following:
Add a constraint to the plan (I used
return Real.Resource('/peel').greaterThan(x);
for a lot of my testing).constraint_run
table now should be populated with a single entry and it shouldn't be marked as outdated.definition_outdated
field should now betrue
.1. Create a model and a plan.2. Add a constraint to the plan (I used
return Real.Resource('/peel').greaterThan(x);
for a lot of my testing).3. Add an activity to the plan and simulate.
4. Do a constraint violation check, the
constraint_run
table now should be populated with a single entry with a statusresolved
.7. Go modify your constraint, that entry in the db should be now marked as
constraint-outdated
.8. Do another constraint violation check, a new entry should exist in the table with a status
resolved
.9. Add another activity and re-simulate.
10. The newest entry in the
constraint_run
table should now be markedsimulation-outdated
.You can also run the constraint violation check in succession to test the caching behavior.
Documentation
I'll update aerie docs to add information about constraint run tracking after this PR is created. Link will be added here.
Future work
Going to work on #514 as a separate ticket.