Code Monkey home page Code Monkey logo

Comments (5)

oxinabox avatar oxinabox commented on August 26, 2024 1

Ah i see, not a abolute path, but a path that does include the directory that walk was done from

julia> walkpath(p"test/util/") |> collect
3-element Vector{PosixPath}:
 p"test/util/Manifest.toml"
 p"test/util/Project.toml"
 p"test/util/generate_test_data.jl"

So we could strip that out ourself:

julia> [relpath(x, p"test/util") for x in walkpath(p"test/util/")]

3-element Vector{PosixPath}:
 p"Manifest.toml"
 p"Project.toml"
 p"generate_test_data.jl"

But doing that would mean we wouldn't have the path for purposes of actually getting the file.

So maybe we do need a base_dir argument for IndexEntry afterall

from checkpoints.jl.

bencottier avatar bencottier commented on August 26, 2024

Possible solutions:

  • Document the assumption of at least 1 tag
  • Add base_path as an argument to IndexEntry so it doesn't have to guess where the base path ends
    • And maybe: assume that the path given to index_checkpoint_files is the longest base path (i.e. checkpoint stuff starts in the first level of subfolders)
  • Determine the base path as the longest common prefix of all checkpoint paths.

from checkpoints.jl.

oxinabox avatar oxinabox commented on August 26, 2024

Is this only a problem when IndexEntry is used directly?
If using index_checkpoint_files(dir) (or index_files) then I think it works fine?
you pass in the "base_dir" already.
You would call for example: index_checkpoint_files(p"example/path/")
and then any directories under that is either for a tag or for the prefix.

If it does work correctly for index_checkpoint_files then I think we should document that including directories that are not either part of tags or prefix in the call to the IndexEntry constructor is not defined.
I don't think we should provide a base_path argument, since it would be exactly as verbose as the user using relpath themselves

from checkpoints.jl.

bencottier avatar bencottier commented on August 26, 2024

It is still incorrect for index_checkpoint_files and index_files, because each filepath that it passes to IndexEntry is an absolute path.

from checkpoints.jl.

bencottier avatar bencottier commented on August 26, 2024

But maybe I see where you are going - a solution is index_checkpoint_files computes a relpath and passes that to IndexEntry. In that case I think we should document this:

assume that the path given to index_checkpoint_files is the longest base path (i.e. checkpoint stuff starts in the first level of subfolders)

from checkpoints.jl.

Related Issues (14)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.