Giter VIP home page Giter VIP logo

Comments (2)

kevin-hanselman avatar kevin-hanselman commented on June 11, 2024

Good find! This situation brings to light several things that need consideration:

Dud treats all inputs to a stage as not cached (skip-cache: true) unless it's owned by another stage. Essentially a stage owns its outputs, and it references its inputs. So in Dud, currently, the recommended way to handle this situation would be to use another stage:

$ dud stage gen -o foo | tee foo.yaml
working-dir: .
outputs:
  foo:
    is-dir: true

$ dud stage gen -i foo -o bar -- cat | tee bar.yaml
command: cat
working-dir: .
inputs:
  foo:
    is-dir: true
outputs:
  bar: {}

$ dud stage add *.yaml
Added bar.yaml to the index.
Added foo.yaml to the index.

$ dud status
foo.yaml  stage definition not checksummed
  foo     1x directory, 1x not committed

bar.yaml  stage definition not checksummed
  bar     missing and not committed

I can see how this could be unintuitive. Frankly, the implicit skip-cache: true has always bugged me. I will reevaluate if it's even needed.

What's more, if you commit a stage with a parent-less directory input, you get skip-cache: false behavior 🤦‍♂️:

# removed '-o bar', which doesn't exist
$ dud stage gen -i foo -- cat > test.yaml

$ dud stage add test.yaml

$ dud commit
committing stage test.yaml
  foo                   4 B / 4 B  100%  ?/s  0s total

# This shouldn't have been committed in Dud's current model.
$ tree -a foo
foo
`-- bar -> ../.dud/cache/49/dc870df1de7fd60794cebce449f5ccdae575affaa67a24b62acb03e039db92

So I have some thinking to do about Dud's stage ownership model. There might be an opportunity here to simplify things by removing implicit behavior. In the meantime, I'd recommend following the pattern in my first example code block.

from dud.

indigoviolet avatar indigoviolet commented on June 11, 2024

Thank you for the quick response! Your first example worked for me. Besides the things you pointed out, please consider changing the error message (incorrect file type: directory) and adding documentation to explain this.

from dud.

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.