Skip to main content

Computation engine for Seamless: execute checksum-addressed transformations in Python or bash

Project description

seamless-transformer

seamless-transformer is the computation engine of the Seamless framework. It takes a transformation — a pure-functional computation defined as a checksum-addressed dict of inputs, code, and language — and executes it, returning a result checksum. It supports Python and bash transformations, multi-process worker pools with shared-memory IPC, and integration with the Seamless caching and remote infrastructure.

Core concepts

A transformation in Seamless is a deterministic computation: given the same inputs and code (identified by their checksums), it always produces the same output. seamless-transformer is responsible for:

  1. Building the transformation dict from the inputs and code, then computing its checksum (which serves as the transformation's identity for caching).
  2. Building the execution namespace: resolving input buffers, compiling modules, injecting dependencies.
  3. Executing the code — either Python (via exec) or bash (via subprocess with file-mapped pins).
  4. Returning the result as a checksum, which can be cached and reused.

Worker pool

For production use, seamless-transformer can spawn a pool of worker processes (seamless_transformer.worker.spawn()). Workers run in separate processes using the spawn multiprocessing context, and communicate with the parent via a custom IPC channel built on multiprocessing.Connection and shared memory.

  • The parent distributes transformation requests to the least-loaded worker.
  • Workers can delegate sub-transformations back to the parent (which redistributes them).
  • Buffer data is exchanged through shared memory to avoid serialization overhead.
  • Workers automatically restart on crash (segfault, etc.).

Integration with the Seamless ecosystem

  • seamless-core: provides the Checksum, Buffer, and buffer-cache primitives that seamless-transformer builds on.
  • seamless-dask: optionally offloads transformations to a Dask cluster (TransformationDaskMixin).
  • seamless-remote: used by the transformation cache to (a) look up cached results in the database before running, (b) access the buffer server for buffer data, and (c) submit transformations to the jobserver for remote execution (an alternative to local execution, not a cache lookup).
  • seamless-config: supplies project/stage selection for storage routing.
  • seamless-jobserver: depends on seamless-transformer to execute transformations received from the job queue.

CLI scripts

Installing seamless-transformer provides:

Command Description
seamless-run The CLI face of Seamless: wrap a bash command or pipeline as a transformation, using file/directory argument names as pin names
seamless-upload Upload input files/directories to the buffer server and write .CHECKSUM sidecar files, staging inputs for seamless-run
seamless-download Fetch result files/directories from the buffer server using .CHECKSUM sidecar files produced by seamless-run
seamless-run-transformation Universal transformation executor: run any Seamless transformation (Python, bash, or other) by checksum and print the result checksum
seamless-queue Run a queue server that executes seamless-run --qsubmit jobs concurrently — the CLI face's parallelization mechanism beyond &
seamless-queue-finish Signal the queue server to drain remaining jobs and shut down
seamless-mode-bind.sh Shell script: source it to bind seamless-mode commands and hotkeys into the current shell session

Installation

pip install seamless-transformer

Setting up seamless-mode

After installing, seamless-mode-bind.sh is available on your PATH. Source it in your shell session to activate the seamless-mode-on, seamless-mode-off, seamless-mode-toggle commands and the Ctrl-U U hotkey.

Manual (any environment) — add to ~/.bashrc or ~/.zshrc:

source $(which seamless-mode-bind.sh)

Conda — auto-activate with the environment:

cp $(which seamless-mode-bind.sh) $CONDA_PREFIX/etc/conda/activate.d/

venv / virtualenv — append to the environment's activate script:

echo "source $(which seamless-mode-bind.sh)" >> $VIRTUAL_ENV/bin/activate

virtualenvwrapper — add to the environment's postactivate hook:

echo "source $(which seamless-mode-bind.sh)" >> $VIRTUAL_ENV/bin/postactivate

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

seamless_transformer-0.2.1.tar.gz (118.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

seamless_transformer-0.2.1-py3-none-any.whl (122.5 kB view details)

Uploaded Python 3

File details

Details for the file seamless_transformer-0.2.1.tar.gz.

File metadata

  • Download URL: seamless_transformer-0.2.1.tar.gz
  • Upload date:
  • Size: 118.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.23

File hashes

Hashes for seamless_transformer-0.2.1.tar.gz
Algorithm Hash digest
SHA256 1ce2e883fc45861ce6e3acf604b17aa9290d4d2c2886db23b68db914a65c3b09
MD5 2f8b5f8a98d0ade2c3ba9d287103692d
BLAKE2b-256 60369619afb0350cfaefe206d84793dc2e0326d10e8a725f02272d7888fb60a3

See more details on using hashes here.

File details

Details for the file seamless_transformer-0.2.1-py3-none-any.whl.

File metadata

File hashes

Hashes for seamless_transformer-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 aecd1a3b1ac9fbcfc48975c5faa023dfc3718d7a21c3a5b4ae5b3f9dc7336e26
MD5 520a8155e9ea25894e9d130a0a533e77
BLAKE2b-256 ca8e43a2f288b1de0bf72627a7caf4fd5e32ba4a04b4960428b24b695df1dce9

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page