Fix/cross year second pass issues - #100
Conversation
|
⏳ I'm reviewing this pull request for security vulnerabilities and code quality issues. I'll provide an update when I'm done |
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
|
✅ I finished the code review, and didn't find any security or code quality issues. |
johncmerfeld
left a comment
There was a problem hiding this comment.
Hang on, I actually want to think about this a little harder
| self.earthmover_run(artifact.EM_RESULTS_X_YEAR.path) | ||
| artifact.EM_RESULTS_X_YEAR.needs_upload = True | ||
| self.upload_artifact(artifact.EM_RESULTS_X_YEAR) | ||
| finally: |
There was a problem hiding this comment.
What's your thinking vis a vis finally here? If Earthmover failed on the second run, then do we even want to reach this point? It should never be the case that EM failed and we return unmatched records to the user
If Earthmover succeeded on the second run, we shouldn't need finally for this to hit.
Very possible something I just said is incorrect. Which scenario are we in at this line?
There was a problem hiding this comment.
Here's what I have come to think through some QA issues that popped up. On the second pass we have essentially 3 phases:
- We check the first run's match rate. If it's above threshold we constrain to use the first run's id type. If it's below, we skip all that and just log a message saying we are rerunning against all ID types.
- We run earthmover. This is what's in the
try. This should definitely happen. - We do some cleanup, but again this is contingent on the first run's match rate. If the first run was successful but the second failed, surely we want to return the first run's records to the user. However, if neither run met threshold, we definitely don't want to return anything to the user. So, in the
finallywe onlyenforce_match_thresholdIF the first run was below threshold.
That's my basic thinking. This came up in QA with a file that had 99% matchrate on the first pass, and 0% on the second pass. Because we enforce_match_threshold regardless, the run errored out, even though nearly every ID could be matched. See the log for this here
There was a problem hiding this comment.
If the first run was successful but the second failed, surely we want to return the first run's records to the user
This is where I disagree.
- If the first pass succeeds and the second fails, then I believe we want to halt. We should return records only if we are confident that the underlying file is fine. If the second pass fails, we never upload the successful output set from the first pass. Thus, we are returning an unmatched_students file to the user that likely will not work when they resubmit it. Better to loudly fail and get to the bottom of why pass 2 did not work.
- I believe that if you remove the
try/finallyand keep just theif not met_initial_threshold:, you will achieve the fix you described without creating this new limbo state
What do you think?
There was a problem hiding this comment.
LMK if I am on the same page as you, maybe I am semantically off base - when I say failed, I mean a run with 0 matches, not a run where earthmover crashed
^ Immediately after writing that I understood the issue here. Yes I totally agree with you, no need to wrap this in a try / finally. Thank you for catching this
There was a problem hiding this comment.
I get the confusion. It used to be that a 0-match run would cause Earthmover to fail/crash but we found it useful to be able to distinguish between those cases
Fixing some cross year issues that came up in QA:
num_unmatched_studentsis set toNone. I added a condition to account for thisenforce_match_thresholdif the first pass DID NOT meet the thresholdLMK if anything seems amiss here