Snakemake storage plugin: http

https://img.shields.io/badge/repository-github-blue?color=#022c22 https://img.shields.io/badge/author-Christopher Tomkins--Tinch-purple?color=#064e3b PyPI - Version PyPI - License

Warning

No documentation found in repository https://github.com/snakemake/snakemake-storage-plugin-http. 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 instractions presented in this catalog.

Installation

Install this plugin by installing it with pip or mamba, e.g.:

pip install snakemake-storage-plugin-http

Usage

Queries

Queries to this storage should have the following format:

Query type

Query

Description

input

https://example.com/file.txt

A file URL

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 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 http --default-storage-prefix ... \
    --storage-http-max-requests-per-second ... \        --storage-http-auth ... \        --storage-http-allow-redirects ...

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="http",
    # optionally add custom settings here if needed
    # alternatively they can be passed via command line arguments
    # starting with --storage-http-..., see
    # snakemake --help
    # Maximum number of requests per second for this storage provider. If nothing is specified, the default implemented by the storage plugin is used.
    max_requests_per_second=...,
    # HTTP(S) authentication. AUTH_TYPE is the class name of requests.auth (e.g. HTTPBasicAuth), ARG1,ARG2,... are the arguments required by the specified type.
    auth=...,
    # Allow redirects when retrieving files.
    allow_redirects=...,

rule example:
    input:
        storage.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="http",
    # optionally add custom settings here if needed
    # alternatively they can be passed via command line arguments
    # starting with --storage-http-..., see below
    # Maximum number of requests per second for this storage provider. If nothing is specified, the default implemented by the storage plugin is used.
    max_requests_per_second=...,
    # HTTP(S) authentication. AUTH_TYPE is the class name of requests.auth (e.g. HTTPBasicAuth), ARG1,ARG2,... are the arguments required by the specified type.
    auth=...,
    # Allow redirects when retrieving files.
    allow_redirects=...,

# register multiple tagged entities
storage foo:
    provider="http",
    # optionally add custom settings here if needed
    # alternatively they can be passed via command line arguments
    # starting with --storage-http-..., see below.
    # To only pass a setting to this tagged entity, prefix the given value with
    # the tag name, i.e. foo:max_requests_per_second=...
    # Maximum number of requests per second for this storage provider. If nothing is specified, the default implemented by the storage plugin is used.
    max_requests_per_second=...,
    # HTTP(S) authentication. AUTH_TYPE is the class name of requests.auth (e.g. HTTPBasicAuth), ARG1,ARG2,... are the arguments required by the specified type.
    auth=...,
    # Allow redirects when retrieving files.
    allow_redirects=...,

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):

CLI setting

Workflow setting

Envvar setting

Description

Default

Choices

Required

Type

--storage-http-max-requests-per-second VALUE

max_requests_per_second

Maximum number of requests per second for this storage provider. If nothing is specified, the default implemented by the storage plugin is used.

None

str

--storage-http-auth AUTH_TYPE=ARG1,ARG2,...

auth

SNAKEMAKE_STORAGE_HTTP_AUTH

HTTP(S) authentication. AUTH_TYPE is the class name of requests.auth (e.g. HTTPBasicAuth), ARG1,ARG2,… are the arguments required by the specified type.

None

str

--storage-http-allow-redirects VALUE

allow_redirects

Allow redirects when retrieving files.

True

str