fix(mfsimulation): respect max_columns_of_data for external arrays#2666
Conversation
Add an optional parameter replace_existing to set_all_data_external() methods, defaulting True. This guarantees that user settings will be respected when these methods are called, at the cost of rewriting when it may not be necessary.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #2666 +/- ##
===========================================
+ Coverage 55.5% 72.7% +17.1%
===========================================
Files 644 667 +23
Lines 124135 129516 +5381
===========================================
+ Hits 68947 94164 +25217
+ Misses 55188 35352 -19836
🚀 New features to boost your workflow:
|
The test failing because of this makes me concerned people might also have scripts expecting the old behavior (not overwriting on This will mean you need to opt into overwriting for column settings to be applied |
|
Changed the default to ...
sim.set_all_data_external()
sim.write_simulation() # Files have N columns
# to rewrite existing files with new column setting
sim.simulation_data.max_columns_of_data = 1
sim.set_all_data_external(replace_existing=True) |
Followup on #2665
Add an optional parameter
replace_existingtoset_all_data_external()methods, defaultingTrue. This guarantees that user settings will be respected when these methods are called, at the cost of rewriting when it may not be necessary. Previously settings were only respected when writing to a new workspace. So, now:This decision prioritizes always respecting user settings. I could also see a case for defaulting
False, so you need to opt into replacing existing files if you want newly modified column settings applied. This would prioritize IO performance over respecting settings. I'm not sure what the right choice is here, curious how others feel.As mentioned in #2419, external files are written on
set_all_data_external()instead of simply configured to be external, then only written onwrite_simulation(). In other words, due to architectural quirks:This PR does nothing to address that. I have looked into a fix but it would be somewhat invasive so I'm tempted to punt to 4.x.