-
Notifications
You must be signed in to change notification settings - Fork 3
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
Implementation of StubDataClayObject #55
Conversation
…ieve class properties and activemethods
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.
Feels good! Some inline comments that should be addressed.
Finally, we will need some tests. Off the top of my hat it should be enough to do: checking make_persistent with alias, checking if the client can put a Stub Dog instance in a Person, checking get/set of attributes, checking the call of activemethods.
… and register new types in module globals
Renamed with `zzz` to be runned the last, since it modifies the module's globals types
…y to avoid cyclic dependencies
…ove unused original module handling; update DataClayPickler to use class method for object retrieval
…le with Docker configuration for services
…mbly on ModuleNotFoundError Bug at retrieving remote DataClayOjects of non-local/non-accessible modules
There is still a bug at retrieving remote instances of DataClayObject sub-classes that are not accessible for the client. When trying to deserialize the pickle binary, it tries to automatically loads the subclass module, and it raises a def reducer_override(self, obj):
if isinstance(obj, DataClayObject):
if not obj._dc_is_registered:
obj.make_persistent()
return DataClayObject.get_by_id, (obj._dc_meta.id,)
else:
return NotImplemented This problem happens because if get_by_id is a class (or class‐) method, then when it’s looked up on an instance of a subclass (say, model.family.Person), it becomes a bound method whose self is that subclass. That means the pickle machinery records that it needs to fetch get_by_id from the subclass (hence the reference to “model.family” and “Person”) instead of from DataClayObject. The error can be replicated by running the following script:
|
That bug (and similar ones) where things that I expected to stumble upon. Same happens if we have a function that returns a persistent object (e.g. a function I was thinking on some ways to address this.
Given that the server ultimately sends object ID and information on the class, it is conceivable that when "DATACLAY_STUB_FALLBACK_FOR_UNKNOWN_CLASSES=True" (flag name TBD) if there is an ImportError in the process of creating the class, the dataClay getter and dataClay active method return transparently fallback to return a Stub
This is the same as the previous one but with something like
This is cumbersome to the programmer, but maybe works as a workaround or a stopgag measure (assuming it is much easier than the previous one, which I am not sure).
or
I am not sure how that would work with a @marcmonfort think a little bit on that, have some time estimate, and if it is not trivial (I think it is NOT trivial) then we can add some "known limitations" section in the documentation and leave it as is right now. |
Previous commit removes the modification of global's module that created errors when running pytest
…duleNotFoundError
All detected corner cases should have been resolved. Note that when using stubs, the retrieval of class information is directed to a random backend. In deployments where certain backends lack the class module while others have it, this may lead to failures. |
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.
LGTM
Implementation of StubDataClayObject