-
Notifications
You must be signed in to change notification settings - Fork 200
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enforce context usage of Container within migrator #6741
base: main
Are you sure you want to change the base?
Conversation
701e658
to
f3f41c1
Compare
2a9ce37
to
eb6e1b4
Compare
9b82abd
to
d4f15b1
Compare
Interesting, it seems using context manager to close the dos container is a footgun design, in principle the resource is only needed when doing real file system operations. |
3d2de49
to
978951e
Compare
for more information, see https://pre-commit.ci
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #6741 +/- ##
===========================================
- Coverage 78.09% 21.23% -56.86%
===========================================
Files 564 564
Lines 42544 42558 +14
===========================================
- Hits 33219 9031 -24188
- Misses 9325 33527 +24202 ☔ View full report in Codecov by Sentry. |
I don't fully understand. My impression is that current code creating engines and sessions by the various initialization of Container is bad design. This results in connections being never explicitly closed. Somehow until Python 3.13 the garbage collection cleaned that up but in the Python 3.13 PR #6600 I had to deal with 5000 file descriptor that are unclosed in the tests resulting in the ssh connection to fail because it cannot open another one. One could keep reusing one session by using one single instance of container, but I wanted to first understand if this would work. Also the it is not clear to me how the Container is supposed to be used. Again public function that just open sessions without keeping track of them makes the usage unclear to me. |
If you look at the
Yes, for the moment, I think just make sure the resource is managed correctly. I'll see if I can abstract the disk-objectstore layer so it can easily attach with other design, even just for test purpose. Anyway, pin me to review this one when it is ready. |
We could put the context into the functions of the Container where the resources are acquired which seems to be only at
in a future PR. |
As mentioned in issue #6739, this is to enforce the correct usage of the container so all acquired resources are correctly released.
TODO Need to test with py313 if open file descriptors are closedworksThis PR goes together with aiidateam/disk-objectstore#179