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
DM-31507 Modify data-structures to aid ref counting #199
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good.
@@ -79,30 +77,32 @@ def __init__(self, butler: Butler, quantum: Quantum): | |||
for refs in quantum.outputs.values(): | |||
for ref in refs: | |||
self.allOutputs.add((ref.datasetType, ref.dataId)) | |||
self._butler_ = butler |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cannot you do self.__butler
instead and avoid __getattribute__
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I really was trying to be difficult, but really this is pragmatic enough I suppose.
@@ -170,13 +174,17 @@ def __init__(self, config=None, name=None, parentTask=None, log=None): | |||
self._display = lsstDebug.Info(self.__module__).display | |||
else: | |||
self._display = None | |||
self._taskDict[self._fullName] = self | |||
self._taskDict[self._fullName] = weakref.ref(self) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it be better to use WeakValueDictionary
for self._taskDict
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I dont know, I thought about that too, but then thought there might be some value to being able to see what keys were there at some point even if the reference was gone. Though this would probably only happen in the most obscure of debug cases, I was ready to punt thinking about it further to get the ticket in.
b138dc6
to
e9ebe4f
Compare
It is desirable that variables get cleaned up when they go out of scope, meaning that their ref count must go to zero. Some objects kept closures or circular references which means they must be cleaned by the garbage collector which can happen at unpredictable times. Make these objects able to be dropped with reference counting.
e9ebe4f
to
7d5fc2f
Compare
It is desirable that variables get cleaned up when they go out of
scope, meaning that their ref count must go to zero. Some objects
kept closures or circular references which means they must be
cleaned by the garbage collector which can happen at unpredictable
times. Make these objects able to be dropped with reference counting.
Checklist
doc/changes