Git Product home page Git Product logo

Comments (7)

skshetry avatar skshetry commented on June 5, 2024

DVC's caches/remotes are content-addressable. There is no 1:1 mapping between cache <> workspace or remote <> workspace.

We don't always preserve timestamps even on the local cache (see #8602). In DVC, we use checksum rather than timestamp, which is superior to my mind.

Unfortunately, I don't have a workaround to suggest here. The same thing would happen if you track with Git.

from dvc.

aschuh-hf avatar aschuh-hf commented on June 5, 2024

But there should be a 1:1 mapping between local DVC cache and remote? As dvc fetch needs to download the object from S3 to a local file. That step should know the S3 object bucket and key (and maybe version ID) and thus be able to obtain the timestamp from there to be able to set the mtime of the file object in the DVC cache I would expect.

The link from workspace to local DVC cache is done in my particular case with link type symlink. This makes it not necessary to preserve file attributes such as mtime between cache and workspace. Only during the remote to cache transfer.

from dvc.

aschuh-hf avatar aschuh-hf commented on June 5, 2024

With Git, I can use git-restore-mtime to set the mtime to the last commit timestamp. For DVC, the equivalent would be "last push of a new object to persistent remote storage" timestamp.

from dvc.

aschuh-hf avatar aschuh-hf commented on June 5, 2024

I see two workarounds for my particular use case:

  • Option 1: Use AWS CLI to populate local DVC cache
aws s3 sync s3://<bucket>/<prefix>/files .dvc/cache/files

This preserves mtime of objects stored in the remote (which is what I would like dvc fetch to do).

  • Option 2: Use GitHub Action to cache .dvc/cache folder
jobs:
  <name>:
    # ...
    steps:
      - name: Restore media cache
        id: cache_media
        uses: actions/cache@v4
        with:
          key: media-${{ hashFiles('.dvc/config') }}
          path: .dvc/cache
      - name: Obtain AWS credentials
        uses: aws-actions/configure-aws-credentials@v4
        with:
          role-to-assume: ***
          aws-region: ***
      - name: Update media files
        run: |
          dvc gc --workspace --force
          dvc pull media.dvc

After either of these two steps, dvc pull or dvc checkout creates the symbolic links in my workspace.

from dvc.

Related Issues (20)

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.