Explicitly define pipeline execution order

Is there a way to specify a dependency between two pipeline stages except for a outs and deps combination? My use case is to run two stages consecutive, although they don’t read / write files, that could be tracked by DVC, but depend on each other in a different way, e.g. by one stage writing a value to an external database and the other one reading it again.

The only way to define stage dependencies is via outs and deps files.

For your situation, you could just write an empty/temporary file as an out for the first stage, and also mark it as cache: false (since you don’t actually need DVC to care about the contents of the file).

Then in the second stage you could add the empty file as a dep, and then also mark the stage as always_changed: true so that the second stage is always executed (even though the content of the empty file won’t ever be modified)

1 Like