Skip to content
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

Record class needs to be defined in a module in distributed mode #35

Open
GreatYYX opened this issue Feb 1, 2019 · 2 comments
Open

Comments

@GreatYYX
Copy link
Member

GreatYYX commented Feb 1, 2019

This issue is caused by incomplete serialization of Record class defined in __main__.

cloudpipe/cloudpickle#243

@GreatYYX GreatYYX added the bug label Feb 1, 2019
@GreatYYX
Copy link
Member Author

GreatYYX commented Feb 1, 2019

Two possible solutions here:

  • let upstream provide the feature to pickle interactively defined property type and the instance of the type.
  • use another way to indicate if the property should be cached: using a function decorator to update indicators in __dict__ instead of using self-defined type of property.

@GreatYYX
Copy link
Member Author

GreatYYX commented Feb 4, 2019

Upstream provided another solution: override __reduce__ in cached_property:

def __reduce__(self):
    return cached_property.__new__, (cached_property, ), {'func': self.func}

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

No branches or pull requests

1 participant