Cherry-picked necessary updates to TableLoader to support the coming StudyLoader class.
StudyLoader does not directly update any models. It just calls other loaders, so TableLoader needed to be able to:
have an empty Models class attribute.
Allow StudyLoader to be able to raise 2 new exceptions: AggregatedErrorsSet and MultiLoadStatus instead of stuffing them into the member AggregatedErrors object. The AggregatedErrorsSet exception is unchanged and its usage in StudyLoader is the same exact usage in the old load_study.py script. Basically, it organizes all of the AggregatedErrors objects from all the different loaders into a dict keyed on study sheet name (load_study.py keyed them on file name). And TableLoader just needs to raise AggregatedErrorsSet and MultiLoadStatus when it sees them
I also added a bunch of is_error and is_fatal arguments to the methods that handle exceptions, though I didn't end up actually using them. The purpose at the time was to resolve an issue where animal loader warnings were somehow resulting in a rollback when it shouldn't have rolled back and the next loader (in order) couldn't access the records from the previous loader it depends on. That problem however turned out to be that I wasn't supplying defer_rollback=True in StudyLoader when it was calling the individual loaders, so I didn't actually need to pass those new arguments. But, it didn't hurt anything and it left the option open to treat exceptions how you want, so I left those changes in.
Affected Issues/Pull Requests
Partially addresses #829
Merges into #1007
Next PR: #1009
Review Notes
See comments in-line.
Checklist
This pull request will be merged once the following requirements are met. The
author and/or reviewers should uncheck any unmet requirements:
Review requirements
Minimum approvals: 1
No changes requested
All blocking issues resolved by reviewers
Specific reviewers: @add_username_here
Review period: 2 days
Associated issue/pull request requirements:
[x] All requirements in affected issues marked "resolved" are satisfied
[x] All required pull requests are merged (or none)
Summary Change Description
Cherry-picked necessary updates to
TableLoader
to support the comingStudyLoader
class.StudyLoader
does not directly update any models. It just calls other loaders, soTableLoader
needed to be able to:Models
class attribute.StudyLoader
to be able to raise 2 new exceptions:AggregatedErrorsSet
andMultiLoadStatus
instead of stuffing them into the memberAggregatedErrors
object. TheAggregatedErrorsSet
exception is unchanged and its usage inStudyLoader
is the same exact usage in the oldload_study.py
script. Basically, it organizes all of theAggregatedErrors
objects from all the different loaders into a dict keyed on study sheet name (load_study.py
keyed them on file name). AndTableLoader
just needs to raiseAggregatedErrorsSet
andMultiLoadStatus
when it sees themI also added a bunch of
is_error
andis_fatal
arguments to the methods that handle exceptions, though I didn't end up actually using them. The purpose at the time was to resolve an issue where animal loader warnings were somehow resulting in a rollback when it shouldn't have rolled back and the next loader (in order) couldn't access the records from the previous loader it depends on. That problem however turned out to be that I wasn't supplyingdefer_rollback=True
inStudyLoader
when it was calling the individual loaders, so I didn't actually need to pass those new arguments. But, it didn't hurt anything and it left the option open to treat exceptions how you want, so I left those changes in.Affected Issues/Pull Requests
Review Notes
See comments in-line.
Checklist
This pull request will be merged once the following requirements are met. The author and/or reviewers should uncheck any unmet requirements:
changelog.md
(or no change)