Snakemake storage plugin: cached-http
Warning
This plugin is not maintained and reviewed by the official Snakemake organization.
Warning
No documentation found in repository https://github.com/pypsa/pypsa-eur. The plugin should provide a docs/intro.md with some introductory sentences and optionally a docs/further.md file with details beyond the auto-generated usage instructions presented in this catalog.
Installation
Install this plugin by installing it with pip or mamba directly, e.g.:
pip install snakemake-storage-plugin-cached-http
Or, if you are using pixi, add the plugin to your pixi.toml. Be careful to put it under the right dependency type based on the plugin’s availability, e.g.:
snakemake-storage-plugin-cached-http = "*"
Usage
Queries
Queries to this storage should have the following format:
Query type |
Query |
Description |
|---|---|---|
input |
|
A Zenodo file URL (currently the only supported HTTP source) |
As default provider
If you want all your input and output (which is not explicitly marked to come from another storage) to be written to and read from this storage, you can use it as a default provider via:
snakemake --default-storage-provider cached-http --default-storage-prefix ...
with ... being the prefix of a query under which you want to store all your
results.
You can also pass custom settings via command line arguments:
snakemake --default-storage-provider cached-http --default-storage-prefix ... \
--storage-cached-http-cache ... \
--storage-cached-http-skip-remote-checks ... \
--storage-cached-http-max-concurrent-downloads ...
Within the workflow
If you want to use this storage plugin only for specific items, you can register it inside of your workflow:
# register storage provider (not needed if no custom settings are to be defined here)
storage:
provider="cached-http",
# optionally add custom settings here if needed
# alternatively they can be passed via command line arguments
# starting with --storage-cached-http-..., see
# snakemake --help
# Cache directory for downloaded files (default: platform-dependent user cache dir). Set to "" to deactivate caching.
cache=...,
# Whether to skip metadata checking with remote server (default: False, ie. do check).
skip_remote_checks=...,
# Maximum number of concurrent downloads.
max_concurrent_downloads=...,
rule example:
input:
storage.cached-http(
# define query to the storage backend here
...
),
output:
"example.txt"
shell:
"..."
Using multiple entities of the same storage plugin
In case you have to use this storage plugin multiple times, but with different settings (e.g. to connect to different storage servers), you can register it multiple times, each time providing a different tag:
# register shared settings
storage:
provider="cached-http",
# optionally add custom settings here if needed
# alternatively they can be passed via command line arguments
# starting with --storage-cached-http-..., see below
# Cache directory for downloaded files (default: platform-dependent user cache dir). Set to "" to deactivate caching.
cache=...,
# Whether to skip metadata checking with remote server (default: False, ie. do check).
skip_remote_checks=...,
# Maximum number of concurrent downloads.
max_concurrent_downloads=...,
# register multiple tagged entities
storage foo:
provider="cached-http",
# optionally add custom settings here if needed
# alternatively they can be passed via command line arguments
# starting with --storage-cached-http-..., see below.
# To only pass a setting to this tagged entity, prefix the given value with
# the tag name, i.e. foo:cache=...
# Cache directory for downloaded files (default: platform-dependent user cache dir). Set to "" to deactivate caching.
cache=...,
# Whether to skip metadata checking with remote server (default: False, ie. do check).
skip_remote_checks=...,
# Maximum number of concurrent downloads.
max_concurrent_downloads=...,
rule example:
input:
storage.foo(
# define query to the storage backend here
...
),
output:
"example.txt"
shell:
"..."
Settings
The storage plugin has the following settings (which can be passed via command line, the workflow or environment variables, if provided in the respective columns):