A2R
The name a2r, pronounced as a double r, stands for Archive safe-Remove Rolling. It's a toolbox that provides different tool for:
- Archive automatically Oceanic experiment outputs base on yaml configuration file
- (safe) Rm files if a local copy already exists
- Automatic Rolling with different options on multiple directory with a single command. Also in this case the info about what to delete and how are provided using a yaml configuration file
Installation
Via pip
pip install a2r
Via conda/mamba
mamba install a2r
Usage
Usage: a2r [OPTIONS] COMMAND [ARGS]...
Options:
--version Show the version and exit.
--help Show this message and exit.
Commands:
rolling
saferm
update-md5
Rolling
To keep a directory under rolling, use the command:
Usage: cli.py rolling [OPTIONS]
Options:
-c, --config PATH [required]
--dry-run Dry run mode.
-d, --debug Enable debug mode.
--help Show this message and exit.
Rolling Configuration File
Here a template of a rolling configuration file:
- !CleanPath
path: $PATH_UNDER_ROLLING
fmt: ???????? # YYYYMMDD
safe:
to_keep: X
reference_paths:
- <REF1>
- <REF2>
conditional:
to_keep: Y
expected_files:
- file.exe
- tmp.nc
force:
to_keep: Z
let's comment each section.
CleanPath object
With this, we start to declare a list of !CleanPath objects with two mandatory attributes:
- !CleanPath
path: $PATH_UNDER_ROLLING
fmt: ???????? # YYYYMMDD
path: it's the path to keep under rollingfmt: it's a string bash that represent the format of file/dir to delete. It can contains jolly characters?or*
Safe
safe:
to_keep: X
reference_paths:
- <REF1>
- <REF2>
safe: means for safe rolling, which means delete a file only if an identical local copy already existsto_keep: how much dir/file to not include in the rollingreference_paths: a list of path where to find if a local copy already exists
To consider that the safe mode doesn't remove the dir under rolling.
Conditional
#### Conditional conditional:
to_keep: Y
expected_files:
- file.exe
- tmp.nc
conditional: specify to remove a dir if some conditions are meetto_keep: how much dir/file to not include in the rollingexpected_files: specify the exact list of files expected to find in rolling path to trigger the rm operations. The filename can contains jolly character?and*
Force
force: # optional
to_keep: Z
force: Enable path rm without any checkto_keep: how much dir/file to not include in the rolling
Update md5 dir
A requirement to safe clean, is to compute in advance the md5 of all files in the rolling path using the command:
update-md5 [OPTIONS]
Options:
-p, --path PATH [required]
-d, --debug Enable debug mode.
--help Show this message and exit.
The command will create in the directory a file called .dir_md5.txt with the following structure:
md5hash filename1
md5hash filename2
Safe Clean
Safe Rm command is the equivalent of safe rm rolling section: it removes files from clean path only if exists an identical copy in keep path
Usage: cli.py saferm [OPTIONS]
Options:
--keep PATH [required]
--clean PATH [required]
-f, --force Delete files without confirm request
-d, --dry-run Disable file removal
-d, --debug Enable debug mode.
--help Show this message and exit.
Metadata
Release files for a2r 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| a2r-0.1.0.tar.gz | 14.8 kB | Without provenance | Details for a2r-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| a2r-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for a2r-0.1.0-py3-none-any.whl |
Total release size: 32.8 kB
Release files / a2r-0.1.0.tar.gz
| Download URL | a2r-0.1.0.tar.gz |
|---|---|
| Size | 14.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b9a78e82bcd754b31b4477454ba58e7a7b264b11e9b2cd3e286eebe321a1d2fe
|
|
BLAKE2b-256 checksum How to use checksums |
8cc654923fff01c54f59b125c35c678325e3f0076ef43bf436151cadd23171ed
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.8.3 CPython/3.10.14 Linux/6.5.0-1019-oem
|
Release files / a2r-0.1.0-py3-none-any.whl
| Download URL | a2r-0.1.0-py3-none-any.whl |
|---|---|
| Size | 18.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
47f2832f318624c35ae877426b0ace05f987f087dfbe15cbc6bd3521cacff5c7
|
|
BLAKE2b-256 checksum How to use checksums |
94ff61d3d0339f96dd701fb899760f6b18194725d5d44bf405906aeedca07e8e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.8.3 CPython/3.10.14 Linux/6.5.0-1019-oem
|
Security for a2r 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.