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

Add Buffer "constructor-kwargs" header #4164

Merged

Conversation

jakirkham
Copy link
Member

Part of Buffer's serializers' work includes handling subclasses (like cuML's Array). However it doesn't handle any keyword arguments those subclass constructors may need. This changes that by adding an optional (by default trivial) "constructor-kwargs" header. Subclasses can then call their parents' serializer and pack this header with relevant content afterwards. This way during deserialization this content can be passed into the subclass' constructor.

cc @dantegd

Part of `Buffer`'s serializers' work includes handling subclasses (like
cuML's `Array`). However it doesn't handle any keyword arguments those
subclass constructors may need. This changes that by adding an optional
(by default trivial) "constructor-kwargs" header. Subclasses can then
call their parents' serializer and pack this header with relevant
content afterwards. This way during deserialization this content can be
passed into the subclass' constructor.
@codecov
Copy link

codecov bot commented Feb 16, 2020

Codecov Report

Merging #4164 into branch-0.13 will increase coverage by 0.00%.
The diff coverage is n/a.

Impacted file tree graph

@@             Coverage Diff              @@
##           branch-0.13    #4164   +/-   ##
============================================
  Coverage        86.67%   86.67%           
============================================
  Files               50       50           
  Lines             9818     9819    +1     
============================================
+ Hits              8510     8511    +1     
  Misses            1308     1308           

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 6fe4c47...61fe635. Read the comment docs.

@jakirkham
Copy link
Member Author

rerun tests

@kkraus14 kkraus14 added 5 - Ready to Merge Testing and reviews complete, ready to merge Python Affects Python cuDF API. dask Dask issue labels Feb 18, 2020
@kkraus14 kkraus14 merged commit 20052b0 into rapidsai:branch-0.13 Feb 18, 2020
@jakirkham jakirkham deleted the buf_subclass_serialize_kwargs branch February 18, 2020 16:49
@madsbk madsbk mentioned this pull request Nov 1, 2022
3 tasks
rapids-bot bot pushed a commit that referenced this pull request Nov 2, 2022
This PR replaces `DeviceBufferLike` with `Buffer` and clear the way for a spillable sub-class of `Buffer`.

#### Context 
The introduction of the [`DeviceBufferLike`](#11447) protocol was motivated by [the spilling work](#11553), which we initially thought would have to be implemented in Cython. However, it can be done in pure Python, which makes `DeviceBufferLike` an unneeded complexity.  

#### Review notes 

- In order to introduce a spillable-buffer in the future, we still use a factory function, `as_buffer()`, to create Buffers. 
- `buffer.py` is moved into the submodule `core.buffer` to ease organization when adding the spillable-buffer and spilling manager. 

#### Breaking
This PR breaks external use of `Buffer` e.g. `Buffer.__init__` raise an exception now and the `"constructor-kwargs"` header from #4164 has been removed. 
Submitted a PR to fix this in cuml: rapidsai/cuml#4965

##

Authors:
  - Mads R. B. Kristensen (https://github.com/madsbk)

Approvers:
  - Vyas Ramasubramani (https://github.com/vyasr)
  - Ashwin Srinath (https://github.com/shwina)

URL: #12009
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
5 - Ready to Merge Testing and reviews complete, ready to merge dask Dask issue Python Affects Python cuDF API.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants