-
Notifications
You must be signed in to change notification settings - Fork 4
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
Define indexing functionality #22
Conversation
My earlier use-case for a similar type was to make the parsing of multiple different kind of things quick from a single checkpoint. In particular, I wanted to do checkpoint = read_checkpoint(path)
f = Forecaster(checkpoint)
n = Nodes(checkpoint)
dates = checkpointed_dates(checkpoint)
y = forecast(f, n, dates) with only a single call to S3. |
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 like this addition!
path::P | ||
name::AbstractString | ||
groups::NTuple{<:Any, AbstractString} | ||
tags::NTuple{<:Any, Pair{Symbol, <:AbstractString}} |
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.
Oh this is nicer, do you mind changing this line to be consistent across the package?
Checkpoints.jl/src/Checkpoints.jl
Line 28 in d8c15b9
@contextvar CONTEXT_TAGS::Tuple{Vararg{Pair{Symbol, Any}}} = Tuple{}() |
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.
is it? those are the basically same
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.
yeah sure - yours reads more nicely
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 think mine might break, because i contrain them all to be the same abstract sttring subtype, which I know will work in this case, because they are all SubStrings, but might not in others.
src/indexing.jl
Outdated
) | ||
elseif length(inds) == 0 | ||
if hasfield(CheckpointOutput, name) | ||
# as long as we don't have a tag with one of the field names we pass it through |
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 am not sure about this. Sure, the fields are not public API, but changing the behaviour given which tags are used seems evil. How about we error here and tell the user to use the methods?
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.
we could.
Main reason I don't want to is so that tables work.
But we can make tables fail in that case also.
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.
Ok, I leave it up to you to decide. LGTM overall
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 have made that change
Codecov Report
@@ Coverage Diff @@
## main #22 +/- ##
==========================================
- Coverage 95.09% 94.89% -0.21%
==========================================
Files 4 5 +1
Lines 102 137 +35
==========================================
+ Hits 97 130 +33
- Misses 5 7 +2
Continue to review full report at Codecov.
|
This is to make it easy to work with the output of checkpointing.
No mode adhock
walkdir
or use of Glob.jl.Increased robustness against the addition of new tags, or reordering of tags.
TODO: