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

Put indexing in readme #25

Merged
merged 2 commits into from
May 17, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,22 @@ which results in recorded checkpoints at
./path/to/checkpoints/iteration=1/foo1=1/foo2=2/MyPackage/foo.jlso
./path/to/checkpoints/iteration=2/foo1=1/foo2=2/MyPackage/foo.jlso
```

You can use `index_checkpoint_files` to get an index of the files, which is a [Tables.jl](https://github.com/JuliaData/Tables.jl) table and so can e.g. be passed to `DataFrame` (and then you can do things like `groupby` etc):
```julia
julia> using DataFrames

julia> DataFrame(index_checkpoint_files("./path/to/checkpoints/"))
2×6 DataFrame
Row │ prefixes checkpoint_name iteration foo1 foo2 checkpoint_path
│ Tuple… SubString… SubString… SubString… SubString… PosixPath…
─────┼────────────────────────────────────────────────────────────────────────────────────────────────────────
1 │ ("MyPackage",) foo 1 1 2 ./path/to/checkpoints/iteration=…
2 │ ("MyPackage",) foo 2 1 2 ./path/to/checkpoints/iteration=…
```
or worked with directly:
```julia
julia> [checkpoint_path(out) for out in index_checkpoint_files("./path/to/checkpoints/") if out.iteration=="1"]
1-element Array{FilePathsBase.PosixPath,1}:
p"./path/to/checkpoints/iteration=1/foo1=1/foo2=2/MyPackage/foo.jlso"
```