forked from ufs-community/uwtools
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
UW-515 File Copy/Link Tool (ufs-community#429)
- Loading branch information
1 parent
d6b3ae3
commit a6d3be0
Showing
28 changed files
with
779 additions
and
132 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
``uwtools.api.file`` | ||
==================== | ||
|
||
.. automodule:: uwtools.api.file | ||
:members: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,7 @@ API | |
|
||
.. toctree:: | ||
config | ||
file | ||
fv3 | ||
logging | ||
rocoto | ||
|
4 changes: 2 additions & 2 deletions
4
...tions/user_guide/cli/drivers/mode_fv3.rst → docs/sections/user_guide/cli/drivers/fv3.rst
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
Mode ``fv3`` | ||
============ | ||
``fv3`` | ||
======= | ||
|
||
The ``uw`` mode for configuring and running FV3. | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,5 +4,5 @@ Drivers | |
.. toctree:: | ||
:maxdepth: 1 | ||
|
||
mode_fv3 | ||
mode_sfc_climo_gen | ||
fv3 | ||
sfc_climo_gen |
4 changes: 2 additions & 2 deletions
4
..._guide/cli/drivers/mode_sfc_climo_gen.rst → .../user_guide/cli/drivers/sfc_climo_gen.rst
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,174 @@ | ||
``file`` | ||
======== | ||
|
||
The ``uw`` mode for handling filesystem files. | ||
|
||
.. code-block:: text | ||
$ uw file --help | ||
usage: uw file [-h] ACTION ... | ||
Handle files | ||
Optional arguments: | ||
-h, --help | ||
Show help and exit | ||
Positional arguments: | ||
ACTION | ||
copy | ||
Copy files | ||
link | ||
Link files | ||
.. _cli_file_copy_examples: | ||
|
||
``copy`` | ||
-------- | ||
|
||
The ``copy`` action stages files in a target directory by copying files. Any ``KEY`` positional arguments are used to navigate, in the order given, from the top of the config to the :ref:`file block <files_yaml>`. | ||
|
||
.. code-block:: text | ||
% uw file copy --help | ||
usage: uw file copy --target-dir PATH [-h] [--config-file PATH] [--dry-run] [--quiet] [--verbose] | ||
[KEY ...] | ||
Copy files | ||
Required arguments: | ||
--target-dir PATH | ||
Path to target directory | ||
Optional arguments: | ||
-h, --help | ||
Show help and exit | ||
--config-file PATH, -c PATH | ||
Path to config file | ||
--dry-run | ||
Only log info, making no changes | ||
--quiet, -q | ||
Print no logging messages | ||
--verbose, -v | ||
Print all logging messages | ||
KEY | ||
YAML key leading to file dst/src block | ||
Examples | ||
^^^^^^^^ | ||
|
||
Given ``config.yaml`` containing | ||
|
||
.. code-block:: yaml | ||
config: | ||
files: | ||
foo: /path/to/foo | ||
subdir/bar: /path/to/bar | ||
.. code-block:: text | ||
$ uw file copy --target-dir /tmp/target --config-file config.yaml config files | ||
[2024-03-14T19:00:02] INFO Validating config against internal schema files-to-stage | ||
[2024-03-14T19:00:02] INFO 0 UW schema-validation errors found | ||
[2024-03-14T19:00:02] INFO File copies: Initial state: Pending | ||
[2024-03-14T19:00:02] INFO File copies: Checking requirements | ||
[2024-03-14T19:00:02] INFO Copy /tmp/source/foo -> /tmp/target/foo: Initial state: Pending | ||
[2024-03-14T19:00:02] INFO Copy /tmp/source/foo -> /tmp/target/foo: Checking requirements | ||
[2024-03-14T19:00:02] INFO Copy /tmp/source/foo -> /tmp/target/foo: Requirement(s) ready | ||
[2024-03-14T19:00:02] INFO Copy /tmp/source/foo -> /tmp/target/foo: Executing | ||
[2024-03-14T19:00:02] INFO Copy /tmp/source/foo -> /tmp/target/foo: Final state: Ready | ||
[2024-03-14T19:00:02] INFO Copy /tmp/source/bar -> /tmp/target/subdir/bar: Initial state: Pending | ||
[2024-03-14T19:00:02] INFO Copy /tmp/source/bar -> /tmp/target/subdir/bar: Checking requirements | ||
[2024-03-14T19:00:02] INFO Copy /tmp/source/bar -> /tmp/target/subdir/bar: Requirement(s) ready | ||
[2024-03-14T19:00:02] INFO Copy /tmp/source/bar -> /tmp/target/subdir/bar: Executing | ||
[2024-03-14T19:00:02] INFO Copy /tmp/source/bar -> /tmp/target/subdir/bar: Final state: Ready | ||
[2024-03-14T19:00:02] INFO File copies: Final state: Ready | ||
After executing this command: | ||
|
||
.. code-block:: text | ||
$ tree /tmp/target | ||
/tmp/target | ||
├── foo | ||
└── subdir | ||
└── bar | ||
Here, ``foo`` and ``bar`` are copies of their respective source files. | ||
|
||
.. _cli_file_link_examples: | ||
|
||
``link`` | ||
-------- | ||
|
||
The ``link`` action stages files in a target directory by linking files. Any ``KEY`` positional arguments are used to navigate, in the order given, from the top of the config to the :ref:`file block <files_yaml>`. | ||
|
||
.. code-block:: text | ||
% uw file link --help | ||
usage: uw file link --target-dir PATH [-h] [--config-file PATH] [--dry-run] [--quiet] [--verbose] | ||
[KEY ...] | ||
Link files | ||
Required arguments: | ||
--target-dir PATH | ||
Path to target directory | ||
Optional arguments: | ||
-h, --help | ||
Show help and exit | ||
--config-file PATH, -c PATH | ||
Path to config file | ||
--dry-run | ||
Only log info, making no changes | ||
--quiet, -q | ||
Print no logging messages | ||
--verbose, -v | ||
Print all logging messages | ||
KEY | ||
YAML key leading to file dst/src block | ||
Examples | ||
^^^^^^^^ | ||
|
||
Given ``config.yaml`` containing | ||
|
||
.. code-block:: yaml | ||
config: | ||
files: | ||
foo: /path/to/foo | ||
subdir/bar: /path/to/bar | ||
.. code-block:: text | ||
$ uw file link --target-dir /tmp/target --config-file config.yaml config files | ||
[2024-03-14T19:02:49] INFO Validating config against internal schema files-to-stage | ||
[2024-03-14T19:02:49] INFO 0 UW schema-validation errors found | ||
[2024-03-14T19:02:49] INFO File links: Initial state: Pending | ||
[2024-03-14T19:02:49] INFO File links: Checking requirements | ||
[2024-03-14T19:02:49] INFO Link /tmp/target/foo -> /tmp/source/foo: Initial state: Pending | ||
[2024-03-14T19:02:49] INFO Link /tmp/target/foo -> /tmp/source/foo: Checking requirements | ||
[2024-03-14T19:02:49] INFO Link /tmp/target/foo -> /tmp/source/foo: Requirement(s) ready | ||
[2024-03-14T19:02:49] INFO Link /tmp/target/foo -> /tmp/source/foo: Executing | ||
[2024-03-14T19:02:49] INFO Link /tmp/target/foo -> /tmp/source/foo: Final state: Ready | ||
[2024-03-14T19:02:49] INFO Link /tmp/target/subdir/bar -> /tmp/source/bar: Initial state: Pending | ||
[2024-03-14T19:02:49] INFO Link /tmp/target/subdir/bar -> /tmp/source/bar: Checking requirements | ||
[2024-03-14T19:02:49] INFO Link /tmp/target/subdir/bar -> /tmp/source/bar: Requirement(s) ready | ||
[2024-03-14T19:02:49] INFO Link /tmp/target/subdir/bar -> /tmp/source/bar: Executing | ||
[2024-03-14T19:02:49] INFO Link /tmp/target/subdir/bar -> /tmp/source/bar: Final state: Ready | ||
[2024-03-14T19:02:49] INFO File links: Final state: Ready | ||
After executing this command: | ||
|
||
.. code-block:: text | ||
$ tree /tmp/target | ||
/tmp/target | ||
├── foo -> /tmp/source/foo | ||
└── subdir | ||
└── bar -> /tmp/source/bar | ||
Here, ``foo`` and ``bar`` are symbolic links. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,7 @@ Tools | |
.. toctree:: | ||
:maxdepth: 1 | ||
|
||
mode_config | ||
mode_rocoto | ||
mode_template | ||
config | ||
file | ||
rocoto | ||
template |
4 changes: 2 additions & 2 deletions
4
...ions/user_guide/cli/tools/mode_rocoto.rst → .../sections/user_guide/cli/tools/rocoto.rst
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
...ns/user_guide/cli/tools/mode_template.rst → ...ections/user_guide/cli/tools/template.rst
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
.. _files_yaml: | ||
|
||
File Blocks | ||
=========== | ||
|
||
File blocks define files to be staged in a target directory as copies or symbolic links. Keys in such blocks specify destination paths relative to the target directory, and values specify source paths. | ||
|
||
Example block: | ||
|
||
.. code-block:: yaml | ||
foo: /path/to/foo | ||
subdir/bar: /path/to/bar | ||
* Result when copying: | ||
|
||
.. code-block:: text | ||
target/ | ||
├── foo | ||
└── subdir | ||
└── bar | ||
where ``foo`` and ``bar`` are copies of their respective source files. | ||
|
||
* Result when linking: | ||
|
||
.. code-block:: text | ||
target | ||
├── foo -> /path/to/foo | ||
└── subdir | ||
└── bar -> /path/to/bar | ||
where ``foo`` and ``bar`` are symbolic links. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,7 @@ UW YAML | |
components/index | ||
platform | ||
execution | ||
files | ||
updating_values | ||
field_table | ||
rocoto |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.