Skip to main content

FlexLock

Python configuration and run provenance for research and offline data processing.

Documentation · MIT licensed

FlexLock lets you write a config in Python, select and override it from the CLI, and execute locally or through cluster workers. Run records capture configuration, declared source/data dependencies, upstream producers, outputs and return values.

The 0.10.0 release removes automatic cross-run cache search and partial-stage resume policy. See breaking changes.

Configuration and execution

# cfgmod.py
from flexlock import py2cfg
from myproject.stages import prepare, train

cfg = dict(
    runs_root='/shared/project/runs',
    track='intensity', arm='baseline', run='20261016-seed3',
    run_dir='${runs_root}/${track}/${arm}/${run}',
    upstream_run='/shared/project/runs/preparation/base/20261001/prepare',
    main=py2cfg(train,
        save_dir='${run_dir}/train',
        input_path='${run_lock:${upstream_run},config.output_path}',
        checkpoint_path='${run_dir}/train/model.pt',
        _snapshot_=dict(data=dict(dataset='${...input_path}')),
        _outputs_=dict(model=dict(path='model.pt', sha256=True))),
)
flexlock-run -d cfgmod.cfg -s main -o upstream_run=/shared/runs/other/prepare
flexlock-run -d cfgmod.cfg -s main --sweep-file configs/smoke.yaml --n_jobs 2
flexlock-run -d cfgmod.cfg -s main --slurm-config configs/slurm_gpu.yaml

Choose fresh destinations for independent runs. Occupied run directories raise before scheduler submission; active ownership also prevents forced overwrites. Use the workflow recipes for named sweeps, per-item destinations and explicit producer selection.

Python submission uses the same execution kernel:

from flexlock import Project

project = Project('cfgmod.cfg')
result = project.submit('main')
result.raise_on_failure()
print(result.save_dir, result.result)

Provenance and explicit reuse

Source snapshots describe the declared repository scope, including include/exclude patterns. Data hashes and upstream bindings record what the callable consumed. Comparison tools provide evidence for deciding whether preparation remains acceptable after a code change; FlexLock does not choose that scientific policy.

flexlock-diff /shared/runs/producer_a /shared/runs/producer_b

Consumers bind concrete producer paths with run_lock. FlexLock resolves and records the selected producer accurately and rejects identity changes at consumption time. It does not silently substitute a newer producer.

selected = project.submit(cfg, save_dir_policy='skip')

skip reuses exactly the selected complete destination after authoritative-record and declared-output validation. It returns the producer's recorded config. It does not certify equivalence to a new config or current source. force=True intentionally reruns in place and records the new attempt while keeping products in place.

Sweeps and ordered stages

Sweep files keep large cohorts out of comma-separated CLI arguments. Workers claim tasks from a shared SQLite queue, allowing many items with a bounded worker allocation. Project coverage checks distinguish successful processing, valid empty outcomes, exclusions, missing products and failures.

CLI -s prepare train assess executes selected stages in order on one allocation, with distinct provenance and fail-fast execution. Independent pipeline items can run in parallel. Stages needing different resources use separate scheduler jobs and --after, with concrete future producer paths and an accepted-ID ledger.

An unchanged recorded queue can continue pending work without rerunning done rows. For a partially completed pipeline, explicitly select remaining stages, bind retained producers and use fresh destinations. There is no automatic marker-based stage skip.

Further reading

Install this release with pip install flexlock==0.10.2 or from the quentinf00 Conda channel. See the migration notes before upgrading existing callers.

Metadata

Release files for flexlock 0.10.2

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

Source distribution (sdist)

Source distribution for flexlock 0.10.2
File Size Uploaded Provenance Actions
flexlock-0.10.2.tar.gz 462.4 kB Without provenance Details for flexlock-0.10.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for flexlock 0.10.2
File Interpreter ABI Platform Actions
flexlock-0.10.2-py3-none-any.whl Python 3 none any Details for flexlock-0.10.2-py3-none-any.whl

Total release size: 656.5 kB

Release files / flexlock-0.10.2.tar.gz

Download URL flexlock-0.10.2.tar.gz
Size 462.4 kB
Tags Source
SHA-256 checksum
How to use checksums
b0229c2b1930ca02c0c9e97d1eee7411776be26d642e3cd575e28f40c02f4b82
BLAKE2b-256 checksum
How to use checksums
1963c00838783ad401fea3fbf2e1ca7f149ad2d9866e3b3d149f3ac72eb27bec
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.12

Release files / flexlock-0.10.2-py3-none-any.whl

Download URL flexlock-0.10.2-py3-none-any.whl
Size 194.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b5bd79e59df6981300391e83d1d59b7d1e49105387550a8c2eb2ae0fd2ee491a
BLAKE2b-256 checksum
How to use checksums
ca9b075f14b94d4c9a833816b94d6cb067b9765514f219c7031aac15adbd6e83
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.12

Security for flexlock 0.10.2

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