Fix a bug identified in batch processing - #847
Conversation
Bug identified in batch testing, but unable to replicate. a KeyError is returned. KeyError: 'alt_strand'
|
@John-F-Wagstaff I could not actually replicate the bug. This code should solve it, but I do not know if the return will be OK or whether you would want to raise. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #847 +/- ##
===========================================
+ Coverage 76.32% 76.67% +0.34%
===========================================
Files 37 37
Lines 13054 13253 +199
===========================================
+ Hits 9964 10162 +198
- Misses 3090 3091 +1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
Yes failure in that call to Either we want to wait and retry, and fail hard if that does not work, or just default to failing at this point. (Edit: yes that unfortunately means that return will not be OK here) |
|
I suspected something screwey was goin on, and that this should not happen since its a standard data structure. Shall I update this with a try again, maybe in a loop and if it takes more than a set length of time, raise?? |
|
That might be better, it would be more user friendly, but it might be overkill for now. Also testing database failures sounds awkward. The only way I can think of doing it requires creative testing of just this subsection, and using dummy database objects built to fail selectively. |
|
Can use mock for this rather than needing a dummy database. Let me see what I can cook up. |
|
Ah that is what I meant "dummy database objects" as in fake response giving objects that pretend to be normal database tied hgvs data providers, not actual dummy databases. I agree that the latter would be too much of a pain to set up for normal testing. |
Add retries to periodically and rarely failing code to attempt retries to fetch the data before raising, which includes logging and testing.
|
Passing mock objects etc to make the code go down the correct pathways rather than settin up databases and real objects like hdp. It is the pathway that needs to be tested, i.e. mocking the pathway of the things that would cause the errors rather than generating real ones. It is good enough and would be, as you say, overkill to do it fully. |
|
Yep, exactly, but even that is a bit of a pain. |
|
@John-F-Wagstaff does this look like an OK solution now? I have added mock object tests and now have all but full coverage of the file. Are the retry settings before raising adequate? |
John-F-Wagstaff
left a comment
There was a problem hiding this comment.
It all looks good.
Too many retries won't help. I think it is best to start low like you have, if we need to up it we might have to up delay as well, which would be non optimal if this works as-is.
|
Exactly my thoughts. It's unlikely to fail once, if it does it'll likely catch the second time and work. |
Merge pull request #847 from openvar/transcript_map_data_bug Fix a bug identified in batch processing
Bug identified in batch testing, but unable to replicate. a KeyError is returned. KeyError: 'alt_strand'