dvc
dvc copied to clipboard
exp run: long dvc.lock update and growing .git folder
Bug Report
Description
The issue occurs when passing nested data as stage dependency.
In my case, a foreach preprocessing stage recreates directories structure from data/raw in data/interim . The latter is added as a dependency of train stage. Running an experiment leads to .git catalog growing approximately the size of data/interim (with object packs from this folder), and if the data is large - quite a long wait for Updating lock file 'dvc.lock' at the end.
Overview (example):
Input data
data
ββββraw
ββββdirA
β file0.txt
β file1.txt
β
ββββdirB
file0.txt
file1.txt
dvc.yaml
stages:
preprocess:
foreach:
${data.data_preprocessing_subdirs}
do:
cmd:
- python src/preprocess.py
--location_dir ${data.data_raw_dir}
--subdir ${item}
--output_dir ${data.data_interim_dir}/${item}
--param ${param1}
deps:
- ${data.data_raw_dir}/${item}
params:
- data.data_interim_dir
- param1
outs:
- ${data.data_interim_dir}/${item}
train:
deps:
- ${data.data_interim_dir}
cmd: echo train
Stages
+--------------+
| data\raw.dvc |
+--------------+
** **
** **
** **
+-----------------+ +-----------------+
| preprocess@dirA | | preprocess@dirB |
+-----------------+ +-----------------+
** **
** **
** **
+-------+
| train |
+-------+
Reproduce
Example repo.
- Create data :
python create_data.py(~20 MB) - Check .git folder size (small)
- (optional) Run just the preprocessing stage:
dvc exp run -fs preprocess. Check .git folder size (small) - Run an experiment
dvc exp run -fCheck .git folder size (~15 MB)
To clean .git folder:
run ./clean.bat
Expected
Not creating objects/packs from data/interim into .git
Environment information
Happens both on Ubuntu and Windows.
Output of dvc doctor:
$ dvc doctor
$ dvc doctor
DVC version: 2.53.0 (pip)
-------------------------
Platform: Python 3.10.10 on Linux-5.11.0-1028-aws-x86_64-with-glibc2.31
Subprojects:
dvc_data = 0.47.1
dvc_objects = 0.21.1
dvc_render = 0.3.1
dvc_task = 0.2.0
scmrepo = 0.2.1
Supports:
http (aiohttp = 3.8.4, aiohttp-retry = 2.8.3),
https (aiohttp = 3.8.4, aiohttp-retry = 2.8.3),
s3 (s3fs = 2023.3.0, boto3 = 1.24.59)
Cache types: hardlink, symlink
Cache directory: ext4 on /dev/nvme1n1p1
Caches: local
Remotes: None
Workspace directory: ext4 on /dev/nvme1n1p1
Repo: dvc, git
Repo.site_cache_dir: /var/tmp/dvc/repo/57f4c5775d4ec9e2a135c5075ca98cb3
Output of dvc exp run -fv:
$ dvc exp run -fv
$ dvc exp run -fv
2023-04-09 16:24:39,845 DEBUG: v2.53.0 (pip), CPython 3.10.10 on Linux-5.11.0-1028-aws-x86_64-with-glibc2.31
2023-04-09 16:24:39,845 DEBUG: command: /home/ubuntu/miniconda3/envs/dvctest/bin/dvc exp run -fv
2023-04-09 16:24:40,258 DEBUG: Using experiment params '{'params.yaml': []}'
2023-04-09 16:24:40,567 DEBUG: built tree 'object 0fb7e050ac1522610ccb8e22aca28809.dir'
2023-04-09 16:24:40,567 DEBUG: Computed stage: 'data/raw.dvc' md5: 'None'
2023-04-09 16:24:40,570 DEBUG: built tree 'object 0fb7e050ac1522610ccb8e22aca28809.dir'
2023-04-09 16:24:40,572 DEBUG: Preparing to transfer data from 'memory://dvc-staging/503214078134644a98c57bd41159e851f91e7d98c3c4663a7614b055db229720' to '/home/ubuntu/dvc_git_issue/.dvc/cache'
2023-04-09 16:24:40,572 DEBUG: Preparing to collect status from '/home/ubuntu/dvc_git_issue/.dvc/cache'
2023-04-09 16:24:40,572 DEBUG: Collecting status from '/home/ubuntu/dvc_git_issue/.dvc/cache'
2023-04-09 16:24:40,573 DEBUG: Saving information to 'data/raw.dvc'.
2023-04-09 16:24:40,648 DEBUG: Stashed experiment '97d28eb' with baseline '44e18e0' for future execution.
2023-04-09 16:24:40,656 DEBUG: Init workspace executor in '/home/ubuntu/dvc_git_issue'
2023-04-09 16:24:40,976 DEBUG: Running repro in '/home/ubuntu/dvc_git_issue'
2023-04-09 16:24:40,976 DEBUG: Removing '/home/ubuntu/dvc_git_issue/.dvc/tmp/repro.dat'
2023-04-09 16:24:41,000 DEBUG: built tree 'object df7830e228f694930d950a479628786c.dir'
2023-04-09 16:24:41,004 DEBUG: built tree 'object f9418aa2e137f1288883a4cce90aa465.dir'
2023-04-09 16:24:41,007 DEBUG: built tree 'object 0fb7e050ac1522610ccb8e22aca28809.dir'
Verifying data sources in stage: 'data/raw.dvc'
2023-04-09 16:24:41,040 DEBUG: built tree 'object 0fb7e050ac1522610ccb8e22aca28809.dir'
2023-04-09 16:24:41,040 DEBUG: Computed stage: 'data/raw.dvc' md5: 'None'
2023-04-09 16:24:41,042 DEBUG: built tree 'object 0fb7e050ac1522610ccb8e22aca28809.dir'
2023-04-09 16:24:41,042 DEBUG: Preparing to transfer data from 'memory://dvc-staging/503214078134644a98c57bd41159e851f91e7d98c3c4663a7614b055db229720' to '/home/ubuntu/dvc_git_issue/.dvc/cache'
2023-04-09 16:24:41,042 DEBUG: Preparing to collect status from '/home/ubuntu/dvc_git_issue/.dvc/cache'
2023-04-09 16:24:41,042 DEBUG: Collecting status from '/home/ubuntu/dvc_git_issue/.dvc/cache'
2023-04-09 16:24:41,044 DEBUG: built tree 'object 0fb7e050ac1522610ccb8e22aca28809.dir'
2023-04-09 16:24:41,044 DEBUG: Removing '/home/ubuntu/dvc_git_issue/data/.VZdMQFCLznNdnNLQkRU9fU.tmp'
2023-04-09 16:24:41,044 DEBUG: Removing '/home/ubuntu/dvc_git_issue/data/.VZdMQFCLznNdnNLQkRU9fU.tmp'
2023-04-09 16:24:41,045 DEBUG: Removing '/home/ubuntu/dvc_git_issue/data/.VZdMQFCLznNdnNLQkRU9fU.tmp'
2023-04-09 16:24:41,045 DEBUG: Removing '/home/ubuntu/dvc_git_issue/.dvc/cache/.Rg8cBzfYGouSedfpr8qz3n.tmp'
2023-04-09 16:24:41,045 DEBUG: Removing '/home/ubuntu/dvc_git_issue/data/raw/dirB/file0.txt'
2023-04-09 16:24:41,048 DEBUG: Removing '/home/ubuntu/dvc_git_issue/data/raw/dirA/file1.txt'
2023-04-09 16:24:41,048 DEBUG: Removing '/home/ubuntu/dvc_git_issue/data/raw/dirB/file1.txt'
2023-04-09 16:24:41,048 DEBUG: Removing '/home/ubuntu/dvc_git_issue/data/raw/dirA/file0.txt'
2023-04-09 16:24:41,058 DEBUG: stage: 'data/raw.dvc' was reproduced
2023-04-09 16:24:41,059 DEBUG: Saving information to 'data/raw.dvc'.
2023-04-09 16:24:41,062 DEBUG: Staging files: {'data/raw.dvc'}
2023-04-09 16:24:41,068 DEBUG: Removing output 'data/interim/dirA' of stage: 'preprocess@dirA'.
2023-04-09 16:24:41,068 DEBUG: Removing '/home/ubuntu/dvc_git_issue/data/interim/dirA'
Running stage 'preprocess@dirA':
> python src/preprocess.py --location_dir data/raw --subdir dirA --output_dir data/interim/dirA --param param1
2023-04-09 16:24:41,162 DEBUG: built tree 'object 4fa81797ba46952cd305bf0d7b3499f3.dir'
2023-04-09 16:24:41,203 DEBUG: built tree 'object df7830e228f694930d950a479628786c.dir'
2023-04-09 16:24:41,203 DEBUG: Computed stage: 'preprocess@dirA' md5: 'e9733d284ef73e913501270a9e02e281'
2023-04-09 16:24:41,204 DEBUG: built tree 'object 4fa81797ba46952cd305bf0d7b3499f3.dir'
2023-04-09 16:24:41,206 DEBUG: built tree 'object 4fa81797ba46952cd305bf0d7b3499f3.dir'
2023-04-09 16:24:41,211 DEBUG: built tree 'object df7830e228f694930d950a479628786c.dir'
2023-04-09 16:24:41,211 DEBUG: Preparing to transfer data from 'memory://dvc-staging/503214078134644a98c57bd41159e851f91e7d98c3c4663a7614b055db229720' to '/home/ubuntu/dvc_git_issue/.dvc/cache'
2023-04-09 16:24:41,211 DEBUG: Preparing to collect status from '/home/ubuntu/dvc_git_issue/.dvc/cache'
2023-04-09 16:24:41,211 DEBUG: Collecting status from '/home/ubuntu/dvc_git_issue/.dvc/cache'
2023-04-09 16:24:41,213 DEBUG: built tree 'object df7830e228f694930d950a479628786c.dir'
2023-04-09 16:24:41,213 DEBUG: Removing '/home/ubuntu/dvc_git_issue/data/interim/.3i8JAPU6nYBWGqAjrw3kzQ.tmp'
2023-04-09 16:24:41,213 DEBUG: Removing '/home/ubuntu/dvc_git_issue/data/interim/.3i8JAPU6nYBWGqAjrw3kzQ.tmp'
2023-04-09 16:24:41,214 DEBUG: Removing '/home/ubuntu/dvc_git_issue/data/interim/.3i8JAPU6nYBWGqAjrw3kzQ.tmp'
2023-04-09 16:24:41,214 DEBUG: Removing '/home/ubuntu/dvc_git_issue/.dvc/cache/.YmmBxW275LrMRbdZUhk6w4.tmp'
2023-04-09 16:24:41,214 DEBUG: Removing '/home/ubuntu/dvc_git_issue/data/interim/dirA/file1.txt'
2023-04-09 16:24:41,215 DEBUG: Removing '/home/ubuntu/dvc_git_issue/data/interim/dirA/file0.txt'
2023-04-09 16:24:41,223 DEBUG: stage: 'preprocess@dirA' was reproduced
2023-04-09 16:24:41,285 DEBUG: Staging files: {'params.yaml', 'data/raw.dvc', 'dvc.yaml'}
2023-04-09 16:24:41,291 DEBUG: Removing output 'data/interim/dirB' of stage: 'preprocess@dirB'.
2023-04-09 16:24:41,291 DEBUG: Removing '/home/ubuntu/dvc_git_issue/data/interim/dirB'
Running stage 'preprocess@dirB':
> python src/preprocess.py --location_dir data/raw --subdir dirB --output_dir data/interim/dirB --param param1
2023-04-09 16:24:41,381 DEBUG: built tree 'object dfbe2e1e52a224fbb90e2fdc634a21c5.dir'
2023-04-09 16:24:41,422 DEBUG: built tree 'object f9418aa2e137f1288883a4cce90aa465.dir'
2023-04-09 16:24:41,422 DEBUG: Computed stage: 'preprocess@dirB' md5: '00a391b33e9d7fdb816efa9e11229241'
2023-04-09 16:24:41,423 DEBUG: built tree 'object dfbe2e1e52a224fbb90e2fdc634a21c5.dir'
2023-04-09 16:24:41,425 DEBUG: built tree 'object dfbe2e1e52a224fbb90e2fdc634a21c5.dir'
2023-04-09 16:24:41,430 DEBUG: built tree 'object f9418aa2e137f1288883a4cce90aa465.dir'
2023-04-09 16:24:41,430 DEBUG: Preparing to transfer data from 'memory://dvc-staging/503214078134644a98c57bd41159e851f91e7d98c3c4663a7614b055db229720' to '/home/ubuntu/dvc_git_issue/.dvc/cache'
2023-04-09 16:24:41,430 DEBUG: Preparing to collect status from '/home/ubuntu/dvc_git_issue/.dvc/cache'
2023-04-09 16:24:41,430 DEBUG: Collecting status from '/home/ubuntu/dvc_git_issue/.dvc/cache'
2023-04-09 16:24:41,432 DEBUG: built tree 'object f9418aa2e137f1288883a4cce90aa465.dir'
2023-04-09 16:24:41,432 DEBUG: Removing '/home/ubuntu/dvc_git_issue/data/interim/.Rxei9ikug8JkFzDXWLK3ah.tmp'
2023-04-09 16:24:41,432 DEBUG: Removing '/home/ubuntu/dvc_git_issue/data/interim/.Rxei9ikug8JkFzDXWLK3ah.tmp'
2023-04-09 16:24:41,433 DEBUG: Removing '/home/ubuntu/dvc_git_issue/data/interim/.Rxei9ikug8JkFzDXWLK3ah.tmp'
2023-04-09 16:24:41,433 DEBUG: Removing '/home/ubuntu/dvc_git_issue/.dvc/cache/.Y3goX8crDFNvzHAjZj6NNw.tmp'
2023-04-09 16:24:41,433 DEBUG: Removing '/home/ubuntu/dvc_git_issue/data/interim/dirB/file1.txt'
2023-04-09 16:24:41,434 DEBUG: Removing '/home/ubuntu/dvc_git_issue/data/interim/dirB/file0.txt'
2023-04-09 16:24:41,442 DEBUG: stage: 'preprocess@dirB' was reproduced
2023-04-09 16:24:41,473 DEBUG: Staging files: {'params.yaml', 'data/raw.dvc', 'dvc.yaml'}
Running stage 'train':
> echo train
train
2023-04-09 16:24:41,488 DEBUG: built tree 'object 5955cc4ea500e05554ffcb0b0b50f3c2.dir'
2023-04-09 16:24:41,495 DEBUG: Computed stage: 'train' md5: 'ea54f69edfd2732f63f9707561280f11'
2023-04-09 16:24:41,496 DEBUG: stage: 'train' was reproduced
2023-04-09 16:24:41,527 DEBUG: Staging files: {'params.yaml', 'data/interim', 'data/raw.dvc', 'dvc.yaml'}
2023-04-09 16:24:42,595 DEBUG: Staging files: {'params.yaml', 'data/interim', 'data/raw.dvc', 'dvc.yaml'}
2023-04-09 16:24:42,629 DEBUG: Staging files: {'params.yaml', 'data/interim', 'data/raw.dvc', 'dvc.yaml'}
2023-04-09 16:24:42,694 DEBUG: Commit to new experiment branch 'refs/exps/44/e18e01fdad792c179bea483734f9aa34e4b1a4/ashen-mesh'
2023-04-09 16:24:42,770 DEBUG: Collected experiment 'aa7f613'.
2023-04-09 16:24:42,771 DEBUG: Removing '/home/ubuntu/dvc_git_issue/.dvc/tmp/exps/run/workspace'
Ran experiment(s): ashen-mesh
Experiment results have been applied to your workspace.
To promote an experiment to a Git branch run:
dvc exp branch <exp> <branch>
2023-04-09 16:24:42,776 DEBUG: Analytics is disabled.