Skip to content

fix: Let writing data to file at flush#213

Open
filimarc wants to merge 5 commits intomainfrom
fix/checkpoint_flush
Open

fix: Let writing data to file at flush#213
filimarc wants to merge 5 commits intomainfrom
fix/checkpoint_flush

Conversation

@filimarc
Copy link
Contributor

@filimarc filimarc commented Jan 27, 2026

Describe the work done

Add a fix to the simulation checkpoint integration, since it is the expected behavior. Now when results are flushed they are written to file without storing memory. As discussed backward compatibility is preserved, the new behavior is triggered only when run_simulation method is called specifying output_filename argument, this will be the default when CLI is used.

Refer to issue: #50

Tasks


📚 Documentation preview 📚: https://bsb-nest--213.org.readthedocs.build/en/213/


📚 Documentation preview 📚: https://bsb-neuron--213.org.readthedocs.build/en/213/


📚 Documentation preview 📚: https://bsb-core--213.org.readthedocs.build/en/213/

@github-actions github-actions bot added the fix label Jan 27, 2026
@codecov
Copy link

codecov bot commented Jan 27, 2026

Codecov Report

❌ Patch coverage is 84.09091% with 7 lines in your changes missing coverage. Please review.
✅ Project coverage is 85.09%. Comparing base (0a46140) to head (92d2334).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
packages/bsb-core/bsb/simulation/results.py 74.07% 6 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #213      +/-   ##
==========================================
+ Coverage   78.72%   85.09%   +6.36%     
==========================================
  Files         196      122      -74     
  Lines       18171    12531    -5640     
  Branches     2142     1467     -675     
==========================================
- Hits        14305    10663    -3642     
+ Misses       3311     1536    -1775     
+ Partials      555      332     -223     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@filimarc filimarc requested a review from Helveg January 28, 2026 09:20
Copy link
Contributor

@Helveg Helveg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! Double check what's going on with multi-sim, and multi-block.

  • Add a test with a 1 sim that writes 3 blocks, and verify data goes into correct blocks
  • Add a test with 3 sims that each write to 2-3 blocks and also verify integrity
  • Add a test that tries to write 10G to disk and check that memory stays flat.

Comment on lines +237 to +238
# else:
# result.write(root / f"{uuid4()}.nio", "ow")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# else:
# result.write(root / f"{uuid4()}.nio", "ow")

self.name = simulation.name
io = io.NixIO(filename, mode="rw")
io.write(Block(name=self.name, nix_name=self.name, config=tree))
for i, nixblock in enumerate(io.nix_file.blocks):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

something seems off here, only 1 block id is ever stored, so it seems like everything will write to the first block?

each simulation should write to their own block inside the same file

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants