From 74ab20480537dbe6d4463bf081581510f10d99d0 Mon Sep 17 00:00:00 2001 From: PseudoNerd Date: Tue, 19 May 2020 16:34:26 +0530 Subject: [PATCH 1/8] Added a reference to dvc cache dir in shared-development-server page and updated dvc cache dir docs --- content/docs/command-reference/cache/dir.md | 6 +++++- content/docs/use-cases/shared-development-server.md | 8 +++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/content/docs/command-reference/cache/dir.md b/content/docs/command-reference/cache/dir.md index 3a118f30a1..bbe022976a 100644 --- a/content/docs/command-reference/cache/dir.md +++ b/content/docs/command-reference/cache/dir.md @@ -20,7 +20,7 @@ Helper to set the `cache.dir` configuration option. (See [cache directory](/doc/user-guide/dvc-files-and-directories#structure-of-cache-directory).) Unlike doing so with `dvc config cache`, this command transform paths (`value`) that are provided relative to the current working directory into paths -**relative to the config file location**. They are required in the latter form +**relative to the config file location** of your own project. They are required in the latter form for the config file. ## Options @@ -61,6 +61,8 @@ $ cat .dvc/config `../dir` has been resolved relative to the `.dvc/` dir, resulting in `../../dir`. +Thecommand `dvc cache dir` resolves your relative paths so that they work with the location of the config file in your project. + ## Example: Using absolute path ```dvc @@ -73,3 +75,5 @@ $ cat .dvc/config ``` Absolute path `/path/to/dir` saved as is. + +As compared to the `dvc config cache.dir` command, this is a higher level command which is specific to a set of use cases. To know more about usage of `dvc config cache` refer to the [cache](/doc/command-reference/config#cache) section in the `config` docs. \ No newline at end of file diff --git a/content/docs/use-cases/shared-development-server.md b/content/docs/use-cases/shared-development-server.md index 4058c808b6..2211a1db4c 100644 --- a/content/docs/use-cases/shared-development-server.md +++ b/content/docs/use-cases/shared-development-server.md @@ -54,6 +54,12 @@ your project: ```dvc $ dvc config cache.dir /home/shared/dvc-cache ``` +You could also use a dedicated command to specify the cache directory to use a path relative to your project. + +```dvc +$ dvc cache dir /home/shared/dvc-cache +``` +You could choose both of this interchangeably at times but it's more advisable to use `dvc config cache.dir` for using an external cache, as the use of absolute path is much easier than a path relative to your project. And tell DVC to set group permissions on newly created or downloaded cache files: @@ -62,7 +68,7 @@ files: $ dvc config cache.shared group ``` -> See `dvc config cache` for more information on these config options. +> See `dvc config cache` and `dvc cache dir` for more information on these config options. If you're using Git, commit changes to your project's config file (`.dvc/config` by default): From 869d6837b87a48d2c19d372b9653959c99e5e8cb Mon Sep 17 00:00:00 2001 From: PseudoNerd Date: Tue, 19 May 2020 17:02:07 +0530 Subject: [PATCH 2/8] Update the existing PR --- content/docs/command-reference/cache/dir.md | 103 ++++++++++++++++-- .../use-cases/shared-development-server.md | 12 +- 2 files changed, 102 insertions(+), 13 deletions(-) diff --git a/content/docs/command-reference/cache/dir.md b/content/docs/command-reference/cache/dir.md index bbe022976a..8629683d3c 100644 --- a/content/docs/command-reference/cache/dir.md +++ b/content/docs/command-reference/cache/dir.md @@ -5,14 +5,25 @@ using `dvc config cache`). ## Synopsis -```usage +````usage usage: dvc cache dir [-h] [--global] [--system] [--local] [-u] value positional arguments: value Path to cache directory. Relative paths are resolved - relative to the current directory and saved to config - relative to the config file location. -``` + relative to the current directory and saved to config# cache dir + +Set/unset the cache directory location intuitively (compared to +using `dvc config cache`). + +## Synopsis + +```usage +usage: dvc cache dir [-h] [--global] [--system] [--local] [-u] value + +positional arguments: value Path to cache directory. Relative paths are + resolved relative to the current directory and saved to config relative to the + config file location. +```` ## Description @@ -20,8 +31,8 @@ Helper to set the `cache.dir` configuration option. (See [cache directory](/doc/user-guide/dvc-files-and-directories#structure-of-cache-directory).) Unlike doing so with `dvc config cache`, this command transform paths (`value`) that are provided relative to the current working directory into paths -**relative to the config file location** of your own project. They are required in the latter form -for the config file. +**relative to the config file location** of your own project. They are required +in the latter form for the config file. ## Options @@ -50,18 +61,87 @@ for the config file. ## Example: Using relative path ```dvc -$ dvc cache dir ../dir +$ dvc cache dir ../dir $ cat .dvc/config +... +[cache] dir = ../../dir +... +``` + +`../dir` has been resolved relative to the `.dvc/` dir, resulting in +`../../dir`. + +Thecommand `dvc cache dir` resolves your relative paths so that they work with +the location of the config file in your project. + +## Example: Using absolute path + +```dvc +$ dvc cache dir /path/to/dir $ cat .dvc/config ... [cache] - dir = ../../dir + dir = /path/to/dir ... ``` +Absolute path `/path/to/dir` saved as is. + +As compared to the `dvc config cache.dir` command, this is a higher level +command which is specific to a set of use cases. To know more about usage of +`dvc config cache` refer to the [cache](/doc/command-reference/config#cache) +section in the `config` docs. + + relative to the config file location. + +```` + +## Description + +Helper to set the `cache.dir` configuration option. (See [cache +directory](/doc/user-guide/dvc-files-and-directories#structure-of-cache-directory).) +Unlike doing so with `dvc config cache`, this command transform paths (`value`) +that are provided relative to the current working directory into paths +**relative to the config file location** of your own project. They are required +in the latter form for the config file. + +## Options + +- `--global` - modify a global config file (e.g. `~/.config/dvc/config`) instead + of the project's `.dvc/config`. + +- `--system` - modify a system config file (e.g. `/etc/dvc.config`) instead of + `.dvc/config`. + +- `--local` - modify a local [config file](/doc/command-reference/config) + instead of `.dvc/config`. It is located in `.dvc/config.local` and is + Git-ignored. This is useful when you need to specify private config options in + your config that you don't want to track and share through Git (credentials, + private locations, etc). + +- `-u`, `--unset` - remove the `cache.dir` config option from the config file. + Don't provide a `value` argument when employing this flag. + +- `-h`, `--help` - prints the usage/help message, and exit. + +- `-q`, `--quiet` - do not write anything to standard output. Exit with 0 if no + problems arise, otherwise 1. + +- `-v`, `--verbose` - displays detailed tracing information. + +## Example: Using relative path + +```dvc +$ dvc cache dir ../dir $ cat .dvc/config +... +[cache] dir = ../../dir +... +```` + `../dir` has been resolved relative to the `.dvc/` dir, resulting in `../../dir`. -Thecommand `dvc cache dir` resolves your relative paths so that they work with the location of the config file in your project. +Thecommand `dvc cache dir` resolves your relative paths so that they work with +the location of the config file in your project. ## Example: Using absolute path @@ -76,4 +156,7 @@ $ cat .dvc/config Absolute path `/path/to/dir` saved as is. -As compared to the `dvc config cache.dir` command, this is a higher level command which is specific to a set of use cases. To know more about usage of `dvc config cache` refer to the [cache](/doc/command-reference/config#cache) section in the `config` docs. \ No newline at end of file +As compared to the `dvc config cache.dir` command, this is a higher level +command which is specific to a set of use cases. To know more about usage of +`dvc config cache` refer to the [cache](/doc/command-reference/config#cache) +section in the `config` docs. diff --git a/content/docs/use-cases/shared-development-server.md b/content/docs/use-cases/shared-development-server.md index 2211a1db4c..69d761db82 100644 --- a/content/docs/use-cases/shared-development-server.md +++ b/content/docs/use-cases/shared-development-server.md @@ -54,12 +54,17 @@ your project: ```dvc $ dvc config cache.dir /home/shared/dvc-cache ``` -You could also use a dedicated command to specify the cache directory to use a path relative to your project. + +You could also use a dedicated command to specify the cache directory to use a +path relative to your project. ```dvc $ dvc cache dir /home/shared/dvc-cache ``` -You could choose both of this interchangeably at times but it's more advisable to use `dvc config cache.dir` for using an external cache, as the use of absolute path is much easier than a path relative to your project. + +You could choose both of this interchangeably at times but it's more advisable +to use `dvc config cache.dir` for using an external cache, as the use of +absolute path is much easier than a path relative to your project. And tell DVC to set group permissions on newly created or downloaded cache files: @@ -68,7 +73,8 @@ files: $ dvc config cache.shared group ``` -> See `dvc config cache` and `dvc cache dir` for more information on these config options. +> See `dvc config cache` and `dvc cache dir` for more information on these +> config options. If you're using Git, commit changes to your project's config file (`.dvc/config` by default): From cc9861176b1fc474c54cf06781f168fb28c9a487 Mon Sep 17 00:00:00 2001 From: Tanmay Kumar Date: Wed, 20 May 2020 01:32:04 +0530 Subject: [PATCH 3/8] Update dir.md --- content/docs/command-reference/cache/dir.md | 89 +-------------------- 1 file changed, 3 insertions(+), 86 deletions(-) diff --git a/content/docs/command-reference/cache/dir.md b/content/docs/command-reference/cache/dir.md index 8629683d3c..dee5bb0eae 100644 --- a/content/docs/command-reference/cache/dir.md +++ b/content/docs/command-reference/cache/dir.md @@ -5,25 +5,14 @@ using `dvc config cache`). ## Synopsis -````usage +```usage usage: dvc cache dir [-h] [--global] [--system] [--local] [-u] value positional arguments: value Path to cache directory. Relative paths are resolved relative to the current directory and saved to config# cache dir - -Set/unset the cache directory location intuitively (compared to -using `dvc config cache`). - -## Synopsis - -```usage -usage: dvc cache dir [-h] [--global] [--system] [--local] [-u] value - -positional arguments: value Path to cache directory. Relative paths are - resolved relative to the current directory and saved to config relative to the - config file location. -```` + +``` ## Description @@ -84,78 +73,6 @@ $ cat .dvc/config ... ``` -Absolute path `/path/to/dir` saved as is. - -As compared to the `dvc config cache.dir` command, this is a higher level -command which is specific to a set of use cases. To know more about usage of -`dvc config cache` refer to the [cache](/doc/command-reference/config#cache) -section in the `config` docs. - - relative to the config file location. - -```` - -## Description - -Helper to set the `cache.dir` configuration option. (See [cache -directory](/doc/user-guide/dvc-files-and-directories#structure-of-cache-directory).) -Unlike doing so with `dvc config cache`, this command transform paths (`value`) -that are provided relative to the current working directory into paths -**relative to the config file location** of your own project. They are required -in the latter form for the config file. - -## Options - -- `--global` - modify a global config file (e.g. `~/.config/dvc/config`) instead - of the project's `.dvc/config`. - -- `--system` - modify a system config file (e.g. `/etc/dvc.config`) instead of - `.dvc/config`. - -- `--local` - modify a local [config file](/doc/command-reference/config) - instead of `.dvc/config`. It is located in `.dvc/config.local` and is - Git-ignored. This is useful when you need to specify private config options in - your config that you don't want to track and share through Git (credentials, - private locations, etc). - -- `-u`, `--unset` - remove the `cache.dir` config option from the config file. - Don't provide a `value` argument when employing this flag. - -- `-h`, `--help` - prints the usage/help message, and exit. - -- `-q`, `--quiet` - do not write anything to standard output. Exit with 0 if no - problems arise, otherwise 1. - -- `-v`, `--verbose` - displays detailed tracing information. - -## Example: Using relative path - -```dvc -$ dvc cache dir ../dir $ cat .dvc/config -... -[cache] dir = ../../dir -... -```` - -`../dir` has been resolved relative to the `.dvc/` dir, resulting in -`../../dir`. - -Thecommand `dvc cache dir` resolves your relative paths so that they work with -the location of the config file in your project. - -## Example: Using absolute path - -```dvc -$ dvc cache dir /path/to/dir -$ cat .dvc/config -... -[cache] - dir = /path/to/dir -... -``` - -Absolute path `/path/to/dir` saved as is. - As compared to the `dvc config cache.dir` command, this is a higher level command which is specific to a set of use cases. To know more about usage of `dvc config cache` refer to the [cache](/doc/command-reference/config#cache) From 47415b538ca1c7640b15b524468cd793cebc64b6 Mon Sep 17 00:00:00 2001 From: Tanmay Kumar Date: Wed, 20 May 2020 01:32:32 +0530 Subject: [PATCH 4/8] Update shared-development-server.md --- content/docs/use-cases/shared-development-server.md | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/content/docs/use-cases/shared-development-server.md b/content/docs/use-cases/shared-development-server.md index 69d761db82..2d909da3f0 100644 --- a/content/docs/use-cases/shared-development-server.md +++ b/content/docs/use-cases/shared-development-server.md @@ -51,21 +51,11 @@ $ sudo chown -R myuser:ourgroup /home/shared/dvc-cache/ Tell DVC to use the directory we've set up above as the cache for your project: -```dvc -$ dvc config cache.dir /home/shared/dvc-cache -``` - -You could also use a dedicated command to specify the cache directory to use a -path relative to your project. ```dvc $ dvc cache dir /home/shared/dvc-cache ``` -You could choose both of this interchangeably at times but it's more advisable -to use `dvc config cache.dir` for using an external cache, as the use of -absolute path is much easier than a path relative to your project. - And tell DVC to set group permissions on newly created or downloaded cache files: From 301a1734b8f7bc30d22ea87a112ab3fb41ae138e Mon Sep 17 00:00:00 2001 From: Tanmay Kumar Date: Wed, 20 May 2020 01:52:23 +0530 Subject: [PATCH 5/8] Update dir.md --- content/docs/command-reference/cache/dir.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/content/docs/command-reference/cache/dir.md b/content/docs/command-reference/cache/dir.md index dee5bb0eae..9287eae6d8 100644 --- a/content/docs/command-reference/cache/dir.md +++ b/content/docs/command-reference/cache/dir.md @@ -10,7 +10,8 @@ usage: dvc cache dir [-h] [--global] [--system] [--local] [-u] value positional arguments: value Path to cache directory. Relative paths are resolved - relative to the current directory and saved to config# cache dir + relative to the current directory and saved to config + relative to the config file location. ``` From 0c4c70d25751660c11a34e809c305ebee1ad1a40 Mon Sep 17 00:00:00 2001 From: Tanmay Kumar Date: Wed, 20 May 2020 01:58:44 +0530 Subject: [PATCH 6/8] Update shared-development-server.md --- content/docs/use-cases/shared-development-server.md | 1 - 1 file changed, 1 deletion(-) diff --git a/content/docs/use-cases/shared-development-server.md b/content/docs/use-cases/shared-development-server.md index 2d909da3f0..eceefb6f51 100644 --- a/content/docs/use-cases/shared-development-server.md +++ b/content/docs/use-cases/shared-development-server.md @@ -51,7 +51,6 @@ $ sudo chown -R myuser:ourgroup /home/shared/dvc-cache/ Tell DVC to use the directory we've set up above as the cache for your project: - ```dvc $ dvc cache dir /home/shared/dvc-cache ``` From 1dba0274b6d8b386ebfe6a4f92d456b9499ebb56 Mon Sep 17 00:00:00 2001 From: Tanmay Kumar Date: Wed, 20 May 2020 02:04:06 +0530 Subject: [PATCH 7/8] Update dir.md --- content/docs/command-reference/cache/dir.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/content/docs/command-reference/cache/dir.md b/content/docs/command-reference/cache/dir.md index 9287eae6d8..c19bcc19d5 100644 --- a/content/docs/command-reference/cache/dir.md +++ b/content/docs/command-reference/cache/dir.md @@ -11,8 +11,7 @@ usage: dvc cache dir [-h] [--global] [--system] [--local] [-u] value positional arguments: value Path to cache directory. Relative paths are resolved relative to the current directory and saved to config - relative to the config file location. - + relative to the config file location. ``` ## Description From 4113282b7f900325b01c90ceeefaf05b59f55e43 Mon Sep 17 00:00:00 2001 From: "Restyled.io" Date: Tue, 19 May 2020 20:34:14 +0000 Subject: [PATCH 8/8] Restyled by prettier --- content/docs/command-reference/cache/dir.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/docs/command-reference/cache/dir.md b/content/docs/command-reference/cache/dir.md index c19bcc19d5..6b0d36a05a 100644 --- a/content/docs/command-reference/cache/dir.md +++ b/content/docs/command-reference/cache/dir.md @@ -11,7 +11,7 @@ usage: dvc cache dir [-h] [--global] [--system] [--local] [-u] value positional arguments: value Path to cache directory. Relative paths are resolved relative to the current directory and saved to config - relative to the config file location. + relative to the config file location. ``` ## Description