From 2930ea71368ff23700c04b50b50ebbad9578cbb0 Mon Sep 17 00:00:00 2001 From: kurianbenoy Date: Sun, 28 Jul 2019 02:37:44 +0530 Subject: [PATCH 1/5] remove show-checksums flag for dvc status commmand --- dvc/command/status.py | 1 - scripts/completion/dvc.bash | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/dvc/command/status.py b/dvc/command/status.py index 1f8caea80..7bb9fd772 100644 --- a/dvc/command/status.py +++ b/dvc/command/status.py @@ -47,7 +47,6 @@ class CmdDataStatus(CmdDataBase): target=target, jobs=self.args.jobs, cloud=self.args.cloud, - show_checksums=self.args.show_checksums, remote=self.args.remote, all_branches=self.args.all_branches, all_tags=self.args.all_tags, diff --git a/scripts/completion/dvc.bash b/scripts/completion/dvc.bash index 40559950c..e1af3fde1 100644 --- a/scripts/completion/dvc.bash +++ b/scripts/completion/dvc.bash @@ -53,7 +53,7 @@ _dvc_remove='-o --outs -p --purge -f --force $(compgen -G *.dvc)' _dvc_repro='-f --force -s --single-item -c --cwd -m --metrics --dry -i --interactive -p --pipeline -P --all-pipelines --ignore-build-cache --no-commit -R --recursive --downstream $(compgen -G *.dvc)' _dvc_root='' _dvc_run='--no-exec -f --file -c --cwd -d --deps -o --outs -O --outs-no-cache --outs-persist --outs-persist-no-cache -m --metrics -M --metrics-no-cache -y --yes --overwrite-dvcfile --ignore-build-cache --remove-outs --no-commit -w --wdir' -_dvc_status='--show-checksums -j --jobs -r --remote -a --all-branches -T --all-tags -d --with-deps -c --cloud $(compgen -G *.dvc)' +_dvc_status='-j --jobs -r --remote -a --all-branches -T --all-tags -d --with-deps -c --cloud $(compgen -G *.dvc)' _dvc_unlock='$(compgen -G *.dvc)' _dvc_unprotect='$(compgen -G *)' _dvc_update='$(compgen -G *.dvc)' From 7059ccb8512bbb6f7a2eb0f5d136cc14dd6526f7 Mon Sep 17 00:00:00 2001 From: kurianbenoy Date: Sun, 28 Jul 2019 04:56:46 +0530 Subject: [PATCH 2/5] update completion scripts and remove show_checksums from status --- dvc/command/data_sync.py | 3 --- dvc/repo/status.py | 9 ++------- scripts/completion/dvc.bash | 6 +++--- scripts/completion/dvc.zsh | 3 --- 4 files changed, 5 insertions(+), 16 deletions(-) diff --git a/dvc/command/data_sync.py b/dvc/command/data_sync.py index 7b83789d2..f3b519605 100644 --- a/dvc/command/data_sync.py +++ b/dvc/command/data_sync.py @@ -39,7 +39,6 @@ class CmdDataPull(CmdDataBase): target=target, jobs=self.args.jobs, remote=self.args.remote, - show_checksums=self.args.show_checksums, all_branches=self.args.all_branches, all_tags=self.args.all_tags, with_deps=self.args.with_deps, @@ -60,7 +59,6 @@ class CmdDataPush(CmdDataBase): target=target, jobs=self.args.jobs, remote=self.args.remote, - show_checksums=self.args.show_checksums, all_branches=self.args.all_branches, all_tags=self.args.all_tags, with_deps=self.args.with_deps, @@ -80,7 +78,6 @@ class CmdDataFetch(CmdDataBase): target=target, jobs=self.args.jobs, remote=self.args.remote, - show_checksums=self.args.show_checksums, all_branches=self.args.all_branches, all_tags=self.args.all_tags, with_deps=self.args.with_deps, diff --git a/dvc/repo/status.py b/dvc/repo/status.py index 7b880e9e6..32736341a 100644 --- a/dvc/repo/status.py +++ b/dvc/repo/status.py @@ -30,7 +30,6 @@ def _cloud_status( target=None, jobs=None, remote=None, - show_checksums=False, all_branches=False, with_deps=False, all_tags=False, @@ -74,9 +73,7 @@ def _cloud_status( )["local"] ret = {} - status_info = self.cloud.status( - used, jobs, remote=remote, show_checksums=show_checksums - ) + status_info = self.cloud.status(used, jobs, remote=remote) for md5, info in status_info.items(): name = info["name"] status = info["status"] @@ -96,7 +93,6 @@ def status( jobs=None, cloud=False, remote=None, - show_checksums=False, all_branches=False, with_deps=False, all_tags=False, @@ -107,10 +103,9 @@ def status( self, target, jobs, - remote=remote, - show_checksums=show_checksums, all_branches=all_branches, with_deps=with_deps, + remote=remote, all_tags=all_tags, ) return _local_status(self, target, with_deps=with_deps) diff --git a/scripts/completion/dvc.bash b/scripts/completion/dvc.bash index e1af3fde1..d9f2babf9 100644 --- a/scripts/completion/dvc.bash +++ b/scripts/completion/dvc.bash @@ -23,7 +23,7 @@ _dvc_commit='-f --force -d --with-deps -R --recursive $(compgen -G *.dvc)' _dvc_config='-u --unset --local --system --global' _dvc_destroy='-f --force' _dvc_diff='-t --target' -_dvc_fetch='--show-checksums -j --jobs -r --remote -a --all-branches -T --all-tags -d --with-deps -R --recursive $(compgen -G *.dvc)' +_dvc_fetch='-j --jobs -r --remote -a --all-branches -T --all-tags -d --with-deps -R --recursive $(compgen -G *.dvc)' _dvc_get_url='' _dvc_get='-o --out --rev' _dvc_gc='-a --all-branches -T --all-tags -c --cloud -r --remote -f --force -p --projects -j --jobs' @@ -41,8 +41,8 @@ _dvc_move='$(compgen -G *)' _dvc_pipeline='list show' _dvc_pipeline_list='' _dvc_pipeline_show='-c --commands -o --outs --ascii --dot --tree -l --locked $(compgen -G *.dvc)' -_dvc_pull='--show-checksums -j --jobs -r --remote -a --all-branches -T --all-tags -f --force -d --with-deps -R --recursive $(compgen -G *.dvc)' -_dvc_push='--show-checksums -j --jobs -r --remote -a --all-branches -T --all-tags -d --with-deps -R --recursive $(compgen -G *.dvc)' +_dvc_pull='-j --jobs -r --remote -a --all-branches -T --all-tags -f --force -d --with-deps -R --recursive $(compgen -G *.dvc)' +_dvc_push='-j --jobs -r --remote -a --all-branches -T --all-tags -d --with-deps -R --recursive $(compgen -G *.dvc)' _dvc_remote='add default list modify remove' _dvc_remote_add='--global --system --local -d --default -f --force' _dvc_remote_default='--global --system --local -u --unset' diff --git a/scripts/completion/dvc.zsh b/scripts/completion/dvc.zsh index 5dae8b749..8390ff7c4 100644 --- a/scripts/completion/dvc.zsh +++ b/scripts/completion/dvc.zsh @@ -101,7 +101,6 @@ _dvc_diff=( _dvc_fetch=( {-j,--jobs}"[Number of jobs to run simultaneously.]:Number of jobs:" - "--show-checksums[Show checksums instead of file names.]" {-r,--remote}"[Remote repository to fetch from.]:Remote repository:" {-a,--all-branches}"[Fetch cache for all branches.]" {-T,--all-tags}"[Fetch cache for all tags.]" @@ -171,7 +170,6 @@ _dvc_pipeline=( _dvc_pull=( {-j,--jobs}"[Number of jobs to run simultaneously.]:Number of jobs:" - "--show-checksums[Show checksums instead of file names.]" {-r,--remote}"[Remote repository to pull from.]:Remote repository:" {-a,--all-branches}"[Fetch cache for all branches.]" {-T,--all-tags}"[Fetch cache for all tags.]" @@ -183,7 +181,6 @@ _dvc_pull=( _dvc_push=( {-j,--jobs}"[Number of jobs to run simultaneously.]:Number of jobs:" - "--show-checksums[Show checksums instead of file names.]" {-r,--remote}"[Remote repository to push to.]:Remote repository:" {-a,--all-branches}"[Push cache for all branches.]" {-T,--all-tags}"[Push cache for all tags.]" From cba4c45bdbb72cc46ebe6f284907dbc7395a30d1 Mon Sep 17 00:00:00 2001 From: kurianbenoy Date: Sun, 28 Jul 2019 05:30:14 +0530 Subject: [PATCH 3/5] removed show-checksums for files pull, push, data_sync.py and from test files --- dvc/command/data_sync.py | 6 ------ dvc/repo/pull.py | 2 -- dvc/repo/push.py | 5 +---- dvc/repo/status.py | 2 +- tests/func/test_data_cloud.py | 7 ------- 5 files changed, 2 insertions(+), 20 deletions(-) diff --git a/dvc/command/data_sync.py b/dvc/command/data_sync.py index f3b519605..b06412099 100644 --- a/dvc/command/data_sync.py +++ b/dvc/command/data_sync.py @@ -100,12 +100,6 @@ def shared_parent_parser(): shared_parent_parser.add_argument( "-j", "--jobs", type=int, help="Number of jobs to run simultaneously." ) - shared_parent_parser.add_argument( - "--show-checksums", - action="store_true", - default=False, - help="Show checksums instead of file names.", - ) shared_parent_parser.add_argument( "targets", nargs="*", diff --git a/dvc/repo/pull.py b/dvc/repo/pull.py index 380bc86a3..df29dde02 100644 --- a/dvc/repo/pull.py +++ b/dvc/repo/pull.py @@ -7,7 +7,6 @@ def pull( jobs=None, remote=None, all_branches=False, - show_checksums=False, with_deps=False, all_tags=False, force=False, @@ -19,7 +18,6 @@ def pull( remote=remote, all_branches=all_branches, all_tags=all_tags, - show_checksums=show_checksums, with_deps=with_deps, recursive=recursive, ) diff --git a/dvc/repo/push.py b/dvc/repo/push.py index 8787a07c9..c2f43778c 100644 --- a/dvc/repo/push.py +++ b/dvc/repo/push.py @@ -7,7 +7,6 @@ def push( jobs=None, remote=None, all_branches=False, - show_checksums=False, with_deps=False, all_tags=False, recursive=False, @@ -23,6 +22,4 @@ def push( jobs=jobs, recursive=recursive, )["local"] - return self.cloud.push( - used, jobs, remote=remote, show_checksums=show_checksums - ) + return self.cloud.push(used, jobs, remote=remote) diff --git a/dvc/repo/status.py b/dvc/repo/status.py index 32736341a..41e990181 100644 --- a/dvc/repo/status.py +++ b/dvc/repo/status.py @@ -74,7 +74,7 @@ def _cloud_status( ret = {} status_info = self.cloud.status(used, jobs, remote=remote) - for md5, info in status_info.items(): + for _, info in status_info.items(): name = info["name"] status = info["status"] if status in [cloud.STATUS_OK, cloud.STATUS_MISSING]: diff --git a/tests/func/test_data_cloud.py b/tests/func/test_data_cloud.py index a6092c61f..f7bf341fd 100644 --- a/tests/func/test_data_cloud.py +++ b/tests/func/test_data_cloud.py @@ -507,19 +507,14 @@ class TestDataCloudCLIBase(TestDvc): cache_dir = stage_dir.outs[0].cache_path # FIXME check status output - self.main(["status", "-c", "--show-checksums"] + args) self.main(["push"] + args) self.assertTrue(os.path.exists(cache)) self.assertTrue(os.path.isfile(cache)) self.assertTrue(os.path.isfile(cache_dir)) - self.main(["status", "-c", "--show-checksums"] + args) - shutil.rmtree(self.dvc.cache.local.cache_dir) - self.main(["status", "-c", "--show-checksums"] + args) - self.main(["fetch"] + args) self.assertTrue(os.path.exists(cache)) self.assertTrue(os.path.isfile(cache)) @@ -536,8 +531,6 @@ class TestDataCloudCLIBase(TestDvc): self.assertEqual(fd.read(), self.FOO_CONTENTS) self.assertTrue(os.path.isfile(cache_dir)) - self.main(["status", "-c", "--show-checksums"] + args) - # NOTE: check if remote gc works correctly on directories self.main(["gc", "-c", "-f"] + args) shutil.move( From 1f27e661337ee95c5ffcde0211da9cfe24111e03 Mon Sep 17 00:00:00 2001 From: kurianbenoy Date: Wed, 31 Jul 2019 21:03:39 +0530 Subject: [PATCH 4/5] refactor status_info as values in for better performance --- dvc/repo/status.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dvc/repo/status.py b/dvc/repo/status.py index 41e990181..b71856d4b 100644 --- a/dvc/repo/status.py +++ b/dvc/repo/status.py @@ -74,7 +74,7 @@ def _cloud_status( ret = {} status_info = self.cloud.status(used, jobs, remote=remote) - for _, info in status_info.items(): + for _, info in status_info.values(): name = info["name"] status = info["status"] if status in [cloud.STATUS_OK, cloud.STATUS_MISSING]: From ea5c798088e3c43c92e87312fd6c571839f85984 Mon Sep 17 00:00:00 2001 From: Kurian Benoy Date: Thu, 1 Aug 2019 20:28:15 +0530 Subject: [PATCH 5/5] Update dvc/repo/status.py Co-Authored-By: Ruslan Kuprieiev --- dvc/repo/status.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dvc/repo/status.py b/dvc/repo/status.py index b71856d4b..fd267bb83 100644 --- a/dvc/repo/status.py +++ b/dvc/repo/status.py @@ -74,7 +74,7 @@ def _cloud_status( ret = {} status_info = self.cloud.status(used, jobs, remote=remote) - for _, info in status_info.values(): + for info in status_info.values(): name = info["name"] status = info["status"] if status in [cloud.STATUS_OK, cloud.STATUS_MISSING]: