-
Notifications
You must be signed in to change notification settings - Fork 25
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
[r] Add $reopen()
to TileDBObject
#2372
Conversation
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #2372 +/- ##
==========================================
+ Coverage 66.07% 71.26% +5.19%
==========================================
Files 144 54 -90
Lines 13002 4695 -8307
Branches 510 0 -510
==========================================
- Hits 8591 3346 -5245
+ Misses 4311 1349 -2962
+ Partials 100 0 -100
Flags with carried forward coverage won't be shown. Click here to find out more.
|
apis/r/R/TileDBArray.R
Outdated
reopen = function(mode = NULL) { | ||
modes <- c(READ = 'WRITE', WRITE = 'READ') | ||
oldmode <- self$mode() | ||
mode <- mode %||% modes[oldmode] |
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.
The flipping read/write is clever but maybe too hard to read?
Also what happens if mode were "RESUME" ?
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.
Per conversation with @mojaveazure mode
and ingest_mode
are distinct in Python, and must be in R as well.
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.
For $open()
(and therefore $reopen()
); mode cannot be "RESUME"
On the Python side, resume-mode exists only in tiledbsoma.io
; for parity, this means that resume-mode exists/will exist only in the write_soma()
methods and is/will be handled there, but the mode of the array itself cannot be "RESUME"
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.
That will be good to have exposed.
@mlin @bkmartinjr @pablo-gar I'd love to get your feedback |
Expose `TileDBArray$reopen()` as a public API; as R does not have context managers, there's no native way to do the Python construct ```python cls = type(arr) with cls.open(arr.uri, "r") as readarr: # do a read operation even though the array is open in write ``` This PR exposes `$reopen()` to reopen an array in a new mode Modified SOMA methods: - `TileDBArray$reopen()`: now public and includes new default for reopening: if `arr$mode()` is `READ`, will automatically reopen in `WRITE` and vice versa - `TileDBObject$is_open()`: now uses `TileDBObject$mode()` to determine if the array is open as `TileDBObject$mode()` already processes `TileDBObject$private$.mode`
Bump develop version
3ed9920
to
66732a6
Compare
TileDBArray$reopen()
public$reopen()
to TileDBObject
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.
🔥
Expose
$reopen()
as a public API for allTileDBObjects
(groups and arrays); as R does not have context managers, there's no native way to do the Python constructThis PR exposes
$reopen()
to reopen an array or collection in a new modeModified SOMA methods:
TileDBObject$reopen()
: pushed down fromTileDBArray
and now public; includes new default for reopening: ifarr$mode()
isREAD
, will automatically reopen inWRITE
and vice versaTileDBObject$is_open()
: now usesTileDBObject$mode()
to determine if the array is open asTileDBObject$mode()
already processesTileDBObject$private$.mode
Context: #921