Summary: I am trying to define a dvc
step using dvc-run
where the command depends on some environment variables (for instance $HOME
). The problem is that when I'm defining the step on machine A, then the variable is expanded when stored in the .dvc
file. In this case, it won't be possible to reproduce the step on machine B. Did I hit a limitation of dvc
? If that's not the case, what's the right approach?
More details: I faced the issue when trying to define a step for which the command is a docker run
. Say that:
- on machine A
myrepo
is located at/Users/user/myrepo
and - on machine B it is to be found at
/home/ubuntu/myrepo
.
Furthermore, assume I have a script myrepo/script.R
which processes a data file to be found at myrepo/data/mydata.txt
. Lastly, assume that my step's command is something like:
docker run -v $HOME/myrepo/:/prj/ my_docker_image /prj/script.R /prj/data/mydata.txt
If I'm running dvc run -f step.dvc -d ... -d ... [cmd]
where cmd
is the docker
execution above, then in step.dvc
the environment variable $HOME
will be expanded. In this case, the step will be broken on machine B.