Skip to main content

Album plugin for distributed calls

Run an Album solution on many inputs with one command: album run-distributed turns file patterns such as "*.tif" into one task per matching file and runs the tasks one after another or in parallel threads, on the machine where you call it.

Installation

  1. install Album
  2. Activate the album environment:
micromamba activate album
  1. Install this plugin:
micromamba install album-distributed -c conda-forge

Or via pip:

pip install album-distributed

Usage

In the examples, replace solution.py with the path of your solution file or folder, or with the group:name:version coordinates of your solution.

First, list the tasks that would run - --dry-run does not run anything:

album run-distributed solution.py --input_data "*.tif" --dry-run

Then run them:

album run-distributed solution.py --input_data "*.tif" --install

Like album run, run-distributed runs installed solutions. --install installs the solution first if it is not installed yet. Alternatively, install it once with album install solution.py.

  • Put patterns in double quotes. Otherwise your shell replaces *.tif with the file names before Album sees the pattern.
  • Spell out argument names in full: --input_data "*.tif" or --input_data="*.tif".
  • Use / in patterns, on Windows too.

Use cases

Replace input_data, output_data and the other argument names with the arguments of your solution. Patterns use the glob syntax.

Process every file in a folder

album run-distributed solution.py --input_data "*.tif"
Task --input_data
1 a.tif
2 b.tif

Other patterns:

  • "data/input*.tif" - the files in the data folder whose names start with input
  • "**/*.tif" - all .tif files in the current folder and its sub folders

Write each result next to its input

album run-distributed solution.py --input_data "*.tif" --output_data "*_out.tif"
Task --input_data --output_data
1 a.tif a_out.tif
2 b.tif b_out.tif

The * in *_out.tif is replaced with what the * in *.tif matched. If you run the command again, the *_out.tif files are not used as inputs - all inputs are processed again and their results are overwritten.

Write the results into another folder

album run-distributed solution.py --input_data "*.tif" --output_data "output/*.tif"
Task --input_data --output_data
1 a.tif output/a.tif
2 b.tif output/b.tif

To keep the sub folders of the inputs, use ** in both patterns:

album run-distributed solution.py --input_data "**/*.tif" --output_data "output/**/*.tif"
Task --input_data --output_data
1 a.tif output/a.tif
2 x/b.tif output/x/b.tif

run-distributed does not create the output folder - create it first, unless your solution does.

Pair the files of two inputs

For example, process each image with its mask (images/a.tif with masks/a_mask.tif):

album run-distributed solution.py --image "images/*.tif" --mask "masks/*_mask.tif" --output_data "results/*.tif"
Task --image --mask --output_data
1 images/a.tif masks/a_mask.tif results/a.tif
2 images/b.tif masks/b_mask.tif results/b.tif

The files are paired by name. Put the main input first: one task is generated for each file of the first pattern.

Use the same value for every task

album run-distributed solution.py --input_data "*.tif" --model "models/model.pt"
Task --input_data --model
1 a.tif models/model.pt
2 b.tif models/model.pt

Arguments without a pattern are passed unchanged to every task.

Run the tasks in parallel

album run-distributed solution.py --input_data "*.tif" --mode queue --threads 4

See Modes.

Modes

Choose how the tasks run with --mode:

Mode How the tasks run If a task fails
basic (default) one after another, with the output of each task the remaining tasks are not run
queue in parallel, in --threads worker threads (default: 3), without output the other tasks still run

At the end, a summary lists the succeeded and failed tasks. If a task failed, the command exits with a non-zero status.

All threads run on the machine where you call the command and use the same solution environment - choose --threads by the CPU, memory and GPU resources each task needs.

How patterns are matched

  • Patterns work in arguments of type file, directory and string, and in arguments without a type.
  • One task is generated for each file matched by the first pattern on the command line.
  • In the other patterns, each wildcard is replaced with what the corresponding wildcard matched in that file; ** keeps the sub folders.
  • Existing files matched by the other patterns are paired with that file by name.
  • If no task can be generated, a warning explains why. Check the tasks with --dry-run.

Metadata

Release files for album-distributed 0.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for album-distributed 0.3.0
File Size Uploaded Provenance Actions
album_distributed-0.3.0.tar.gz 15.5 kB Without provenance Details for album_distributed-0.3.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for album-distributed 0.3.0
File Interpreter ABI Platform Actions
album_distributed-0.3.0-py3-none-any.whl Python 3 none any Details for album_distributed-0.3.0-py3-none-any.whl

Total release size: 31.2 kB

Release files / album_distributed-0.3.0.tar.gz

Download URL album_distributed-0.3.0.tar.gz
Size 15.5 kB
Tags Source
SHA-256 checksum
How to use checksums
2b829f0176951c8d9734b371c4d8380bec23d805d33cafc5a3ff1c470f26a073
BLAKE2b-256 checksum
How to use checksums
e52926b6ccac42715f1dfb7bba0ad59678426709293f143967ae2e0186e5df93
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.15.0

Release files / album_distributed-0.3.0-py3-none-any.whl

Download URL album_distributed-0.3.0-py3-none-any.whl
Size 15.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a4cead51767d650935d499eaef07656e5de8ec7a98208971195f89c0f659def8
BLAKE2b-256 checksum
How to use checksums
9b7638552119534cf661f2475ffdb46b2a5f1b2b8a8d54a7af064e164869f38f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.15.0

Security for album-distributed 0.3.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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page