Redun
¶
Here, we’ll see how to track redun workflows with lamindb.
Note
This guide is based on github.com/ricomnl/bioinformatics-pipeline-tutorial.
Amend the workflow¶
Here is how to instrument a redun workflow for tracking with lamindb:
Add
ln.track()to themain()task (see on GitHub)Register desired output files or folders by creating artifacts for them (see on GitHub):
ln.Artifact(output_path, key="data/results.tar.gz").save()
Add a
finish()task that callsln.finish()(see on GitHub)Optionally cache/stage input files (see on GitHub)
Why not use @ln.flow() for main()?
Because main() in redun is typically a scheduler/executor task rather than a task that performs the actual computation. ln.flow() would then just track the execution time of scheduling, and not an actual compute run.
If one wanted to use @ln.flow() it’s advisable to wrap the scheduling main() task:
@ln.flow()
def run_pipeline(...):
scheduler = Scheduler()
result = scheduler.run(main(...)) # run the main task
ln.Artifact(result.path, key="data/results.tgz").save()
return result
Run redun¶
Let’s see what the input files are:
ls ./fasta
Show code cell output
KLF4.fasta
MYC.fasta
PO5F1.fasta
SOX2.fasta
Create a lamindb test instance:
# pip install lamindb redun git+http://github.com/laminlabs/redun-lamin-fasta
lamin init --storage ./test-redun-lamin
Show code cell output
→ initialized database testuser1/test-redun-lamin in /home/runner/work/redun-lamin/redun-
lamin/docs
Register each input file individually as an artifact:
import lamindb as ln
import json
ln.Artifact.from_dir("./fasta").save()
Show code cell output
→ connected lamindb: testuser1/test-redun-lamin
! folder is outside existing storage location, will copy files from ./fasta to /home/runner/work/redun-lamin/redun-lamin/docs/test-redun-lamin/fasta
! no run & transform got linked, call `ln.track()` & re-run
! no run & transform got linked, call `ln.track()` & re-run
! no run & transform got linked, call `ln.track()` & re-run
! no run & transform got linked, call `ln.track()` & re-run
SQLRecordList([Artifact(uid='sDlBfZ3h8w42afBF0000', key='fasta/SOX2.fasta', description=None, suffix='.fasta', kind=None, otype=None, size=414, hash='C5q_yaFXGk4SAEpfdqBwnQ', n_files=None, n_observations=None, extra_data=None, branch_id=1, created_on_id=1, space_id=1, storage_id=1, run_id=None, schema_id=None, created_by_id=1, created_at=2026-11-12 23:17:27 UTC, is_locked=False, version_tag=None, is_latest=True),
Artifact(uid='vpSCxg8Dudvm3lSx0000', key='fasta/MYC.fasta', description=None, suffix='.fasta', kind=None, otype=None, size=536, hash='WGbEtzPw-3bQEGcngO_pHQ', n_files=None, n_observations=None, extra_data=None, branch_id=1, created_on_id=1, space_id=1, storage_id=1, run_id=None, schema_id=None, created_by_id=1, created_at=2026-11-12 23:17:27 UTC, is_locked=False, version_tag=None, is_latest=True),
Artifact(uid='RPjfJFmFPzPb9UtK0000', key='fasta/KLF4.fasta', description=None, suffix='.fasta', kind=None, otype=None, size=609, hash='LyuoYkWs4SgYcH7P7JLJtA', n_files=None, n_observations=None, extra_data=None, branch_id=1, created_on_id=1, space_id=1, storage_id=1, run_id=None, schema_id=None, created_by_id=1, created_at=2026-11-12 23:17:27 UTC, is_locked=False, version_tag=None, is_latest=True),
Artifact(uid='Jl6KGUhSgETZIqUo0000', key='fasta/PO5F1.fasta', description=None, suffix='.fasta', kind=None, otype=None, size=477, hash='-7iJgveFO9ia0wE1bqVu6g', n_files=None, n_observations=None, extra_data=None, branch_id=1, created_on_id=1, space_id=1, storage_id=1, run_id=None, schema_id=None, created_by_id=1, created_at=2026-11-12 23:17:27 UTC, is_locked=False, version_tag=None, is_latest=True)])
Run the redun workflow:
redun run workflow.py main --input-dir ./fasta --tag run=test-run 1> run_logs.txt 2>run_logs.txt
Inspect the logs:
cat run_logs.txt
Show code cell output
→ connected lamindb: testuser1/test-redun-lamin
→ script invoked with: run wor
kflow.py main --input-dir ./fasta --tag run=test-run
→ created Transform('jGjYL88ECs7A000
0', key='workflow.py'), started new Run('MtLtHrj59VAf8DP6') at 2026-11-12 23:17:41 UTC
•
tip: to identify the script across renames, pass the uid: ln.track("jGjYL88ECs7A")
File(path=/home/r
unner/work/redun-lamin/redun-lamin/docs/test-redun-lamin/data/results.tgz, hash=7403ae35)
cs_pipelin
e_tutorial.lib.digest_protein_task(input_fasta=File(path=/home/runner/work/redun-lamin/redun-lamin/d
ocs/test-redun-lamin/.lamindb/sDlBfZ3h8w42afBF0000.fasta, hash=c5081d57), enzyme_regex='[KR]', misse
d_cleavages=0, min_length=4, max_length=75) on default
[redun] Run Job 43bb9d03: bioinformatics_
pipeline_tutorial.lib.digest_protein_task(input_fasta=File(path=/home/runner/work/redun-lamin/redun-
lamin/docs/test-redun-lamin/.lamindb/vpSCxg8Dudvm3lSx0000.fasta, hash=0a157bbd), enzyme_regex='[KR]'
, missed_cleavages=0, min_length=4, max_length=75) on default
[redun] Run Job 3223c7fd: bioinfor
matics_pipeline_tutorial.lib.digest_protein_task(input_fasta=File(path=/home/runner/work/redun-lamin
/redun-lamin/docs/test-redun-lamin/.lamindb/RPjfJFmFPzPb9UtK0000.fasta, hash=04b6f1fc), enzyme_regex
='[KR]', missed_cleavages=0, min_length=4, max_length=75) on default
[redun] Run Job 218b04ac: b
ioinformatics_pipeline_tutorial.lib.digest_protein_task(input_fasta=File(path=/home/runner/work/redu
n-lamin/redun-lamin/docs/test-redun-lamin/.lamindb/Jl6KGUhSgETZIqUo0000.fasta, hash=d0a437db), enzym
e_regex='[KR]', missed_cleavages=0, min_length=4, max_length=75) on default
[redun] Run Job e1707
58c: bioinformatics_pipeline_tutorial.lib.count_amino_acids_task(input_fasta=File(path=/home/runner
/work/redun-lamin/redun-lamin/docs/test-redun-lamin/.lamindb/sDlBfZ3h8w42afBF0000.fasta, hash=c5081d
57), input_peptides=File(path=/home/runner/work/redun-lamin/redun-lamin/docs/test-redun-lamin/data/s
DlBfZ3h8w42afBF0000.peptides.txt, hash=aec70798), amino_acid='C') on default
[redun] Run Job 024a
4f2d: bioinformatics_pipeline_tutorial.lib.count_amino_acids_task(input_fasta=File(path=/home/runne
r/work/redun-lamin/redun-lamin/docs/test-redun-lamin/.lamindb/vpSCxg8Dudvm3lSx0000.fasta, hash=0a157
bbd), input_peptides=File(path=/home/runner/work/redun-lamin/redun-lamin/docs/test-redun-lamin/data/
vpSCxg8Dudvm3lSx0000.peptides.txt, hash=5a479986), amino_acid='C') on default
[redun] Run Job 3c2
b05c2: bioinformatics_pipeline_tutorial.lib.count_amino_acids_task(input_fasta=File(path=/home/runn
er/work/redun-lamin/redun-lamin/docs/test-redun-lamin/.lamindb/RPjfJFmFPzPb9UtK0000.fasta, hash=04b6
f1fc), input_peptides=File(path=/home/runner/work/redun-lamin/redun-lamin/docs/test-redun-lamin/data
/RPjfJFmFPzPb9UtK0000.peptides.txt, hash=2173d9a2), amino_acid='C') on default
[redun] Run Job 18
bf6fe8: bioinformatics_pipeline_tutorial.lib.count_amino_acids_task(input_fasta=File(path=/home/run
ner/work/redun-lamin/redun-lamin/docs/test-redun-lamin/.lamindb/Jl6KGUhSgETZIqUo0000.fasta, hash=d0a
437db), input_peptides=File(path=/home/runner/work/redun-lamin/redun-lamin/docs/test-redun-lamin/dat
a/Jl6KGUhSgETZIqUo0000.peptides.txt, hash=fd2f490a), amino_acid='C') on default
[redun] Run Job 4
d7f249c: bioinformatics_pipeline_tutorial.lib.plot_count_task(input_count=File(path=/home/runner/wo
rk/redun-lamin/redun-lamin/docs/test-redun-lamin/data/sDlBfZ3h8w42afBF0000.count.tsv, hash=4b016c30)
) on default
[redun] Run Job 6ea0e085: bioinformatics_pipeline_tutorial.lib.plot_count_task(inpu
t_count=File(path=/home/runner/work/redun-lamin/redun-lamin/docs/test-redun-lamin/data/vpSCxg8Dudvm3
lSx0000.count.tsv, hash=e74524d4)) on default
[redun] Run Job 6ac12930: bioinformatics_pipeline_
tutorial.lib.plot_count_task(input_count=File(path=/home/runner/work/redun-lamin/redun-lamin/docs/te
st-redun-lamin/data/RPjfJFmFPzPb9UtK0000.count.tsv, hash=6d9b2ca8)) on default
[redun] Run Job ef
31d109: bioinformatics_pipeline_tutorial.lib.plot_count_task(input_count=File(path=/home/runner/wor
k/redun-lamin/redun-lamin/docs/test-redun-lamin/data/Jl6KGUhSgETZIqUo0000.count.tsv, hash=c922a563))
on default
[redun] Run Job 4ad8fd99: bioinformatics_pipeline_tutorial.lib.get_report_task(input
_counts=[File(path=/home/runner/work/redun-lamin/redun-lamin/docs/test-redun-lamin/data/sDlBfZ3h8w42
afBF0000.count.tsv, hash=4b016c30), File(path=/home/runner/work/redun-lamin/redun-lamin/docs/test-re
dun-l...) on default
[redun]
[redun] | JOB STATUS 2026/11/12 23:18:03
[redun] | TASK
PENDING RUNNING FAILED CACHED DONE TOTAL
[redun] |
[redun] | ALL 2 5 0
0 9 16
[redun] | bioinformatics_pipeline_tutorial.lib.archive_results_task 1
0 0 0 0 1
[redun] | bioinformatics_pipeline_tutorial.lib.count_amino_acids
_task 0 0 0 0 4 4
[redun] | bioinformatics_pipeline_tutorial.lib
.digest_protein_task 0 0 0 0 4 4
[redun] | bioinformatics_pip
eline_tutorial.lib.get_report_task 0 0 0 0 1 1
[redun] |
bioinformatics_pipeline_tutorial.lib.plot_count_task 0 4 0 0 0
4
[redun] | redun_lamin_fasta.finish 1 0
0 0 0 1
[redun] | redun_lamin_fasta.main
0 1 0 0 0 1
[redun]
[redun]
[redun] Run Job c8c9669d: bioinfor
matics_pipeline_tutorial.lib.archive_results_task(inputs_plots=[File(path=/home/runner/work/redun-la
min/redun-lamin/docs/test-redun-lamin/data/sDlBfZ3h8w42afBF0000.plot.png, hash=a604e1cf), File(path=
/home/runner/work/redun-lamin/redun-lamin/docs/test-redun-la..., input_report=File(path=/home/runner
/work/redun-lamin/redun-lamin/docs/test-redun-lamin/data/protein_report.tsv, hash=1f398210)) on defa
ult
[redun] Run Job cc201331: redun_lamin_fasta.finish(results_archive=File(path=/home/runner/wo
rk/redun-lamin/redun-lamin/docs/test-redun-lamin/data/results.tgz, hash=7403ae35)) on default
[redun
]
[redun] | JOB STATUS 2026/11/12 23:18:08
[redun] | TASK
PENDING RUNNING FAILED CACHED DONE TOTAL
[redun] |
[redun] | ALL
0 0 0 0 16 16
[redun] |
bioinformatics_pipeline_tutorial.lib.archive_results_task 0 0 0 0 1
1
[redun] | bioinformatics_pipeline_tutorial.lib.count_amino_acids_task 0 0
0 0 4 4
[redun] | bioinformatics_pipeline_tutorial.lib.digest_protein_task
0 0 0 0 4 4
[redun] | bioinformatics_pipeline_tutorial.lib.get_repo
rt_task 0 0 0 0 1 1
[redun] | bioinformatics_pipeline_tut
orial.lib.plot_count_task 0 0 0 0 4 4
[redun] | redun_lam
in_fasta.finish 0 0 0 0 1 1
[
redun] | redun_lamin_fasta.main 0 0 0 0
1 1
[redun]
[redun]
[redun] Execution duration: 27.43 seconds
View data lineage¶
artifact = ln.Artifact.get(key="data/results.tgz")
artifact.view_lineage()
Show code cell output
artifact.run.transform.describe()
Show code cell output
Transform: workflow.py (0000) | description: CLI: redun ├── uid: jGjYL88ECs7A0000 │ hash: zjZMEeofUMp3FV6fxbgjYg type: script │ branch: main space: all │ created_at: 2026-11-12 23:17:41 UTC created_by: testuser1 └── source_code: │ """workflow.py.""" │ │ # This code is based on a copy from https://github.com/ricomnl/bioinformatics-pi … │ # Copyright Rico Meinl 2022 │ from enum import Enum │ │ import lamindb as ln │ from redun import File, task │ │ import redun_lamin_fasta │ from redun_lamin_fasta.lib import ( │ archive_results_task, │ count_amino_acids_task, │ digest_protein_task, │ get_report_task, │ plot_count_task, │ ) │ │ redun_namespace = redun_lamin_fasta.__name__ │ │ │ class Executor(str, Enum): │ default = "default" │ process = "process" │ batch = "batch" │ batch_debug = "batch_debug" │ │ │ @task() │ def finish(results_archive: File) -> File: │ …
artifact.run.describe()
Show code cell output
Run: MtLtHrj (workflow.py) ├── uid: MtLtHrj59VAf8DP6 transform: workflow.py (0000) │ started_at: 2026-11-12 23:17:41 UTC finished_at: 2026-11-12 23:18:08 UTC │ status: completed │ branch: main space: all │ created_at: 2026-11-12 23:17:41 UTC created_by: testuser1 ├── cli_args: │ │ run workflow.py main --input-dir ./fasta --tag run=test-run ├── report: 6AwO4PP │ │ → connected lamindb: testuser1/test-redun-lamin │ │ → created Transform('jGjYL88ECs7A0000', key='workflow.py'), started new Run('MtL … │ │ • tip: to identify the script across renames, pass the uid: ln.track("jGjYL88ECs … └── environment: PHY35OX │ aiobotocore==3.10.0 │ aiohappyeyeballs==2.7.1 │ aiohttp==3.14.5 │ aioitertools==0.13.0 │ …
Explore the run on the hub¶
→ lamin.ai/laminlabs/lamindata/transform/taasWKawCiNA
View the database content¶
ln.view()
Show code cell output
Artifact
| uid | key | description | suffix | kind | otype | size | hash | n_files | n_observations | ... | is_latest | is_locked | created_at | branch_id | created_on_id | space_id | storage_id | run_id | schema_id | created_by_id | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| id | |||||||||||||||||||||
| 6 | nfFKoaZ0423VxkRr0000 | data/results.tgz | None | None | None | 94783 | A8lnCVr-yql5YTs6gOsT0A | None | None | ... | True | False | 2026-11-12 23:18:08.919+00:00 | 1 | 1 | 1 | 1 | 1.0 | None | 1 | |
| 4 | Jl6KGUhSgETZIqUo0000 | fasta/PO5F1.fasta | None | .fasta | None | None | 477 | -7iJgveFO9ia0wE1bqVu6g | None | None | ... | True | False | 2026-11-12 23:17:27.732+00:00 | 1 | 1 | 1 | 1 | NaN | None | 1 |
| 3 | RPjfJFmFPzPb9UtK0000 | fasta/KLF4.fasta | None | .fasta | None | None | 609 | LyuoYkWs4SgYcH7P7JLJtA | None | None | ... | True | False | 2026-11-12 23:17:27.732+00:00 | 1 | 1 | 1 | 1 | NaN | None | 1 |
| 2 | vpSCxg8Dudvm3lSx0000 | fasta/MYC.fasta | None | .fasta | None | None | 536 | WGbEtzPw-3bQEGcngO_pHQ | None | None | ... | True | False | 2026-11-12 23:17:27.731+00:00 | 1 | 1 | 1 | 1 | NaN | None | 1 |
| 1 | sDlBfZ3h8w42afBF0000 | fasta/SOX2.fasta | None | .fasta | None | None | 414 | C5q_yaFXGk4SAEpfdqBwnQ | None | None | ... | True | False | 2026-11-12 23:17:27.730+00:00 | 1 | 1 | 1 | 1 | NaN | None | 1 |
5 rows × 22 columns
Run
| uid | name | description | entrypoint | started_at | finished_at | params | extra_data | reference | reference_type | ... | created_at | branch_id | created_on_id | space_id | transform_id | report_id | environment_id | plan_id | created_by_id | initiated_by_run_id | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| id | |||||||||||||||||||||
| 1 | MtLtHrj59VAf8DP6 | None | None | None | 2026-11-12 23:17:41.698+00:00 | 2026-11-12 23:18:08.946400+00:00 | None | None | None | None | ... | 2026-11-12 23:17:41.698+00:00 | 1 | 1 | 1 | 1 | 7 | 5 | None | 1 | None |
1 rows × 22 columns
Storage
| uid | root | description | type | region | instance_uid | is_locked | created_at | branch_id | created_on_id | space_id | created_by_id | run_id | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| id | |||||||||||||
| 1 | R8U3v4kkGlRP | /home/runner/work/redun-lamin/redun-lamin/docs... | None | local | None | iQlBPgD8uaqR | False | 2026-11-12 23:17:24.960+00:00 | 1 | 1 | 1 | 1 | None |
Transform
| uid | key | description | kind | source_code | hash | reference | reference_type | version_tag | is_latest | is_locked | created_at | branch_id | created_on_id | space_id | environment_id | plan_id | run_id | created_by_id | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| id | |||||||||||||||||||
| 1 | jGjYL88ECs7A0000 | workflow.py | CLI: redun | script | """workflow.py."""\n\n# This code is based on ... | zjZMEeofUMp3FV6fxbgjYg | None | None | None | True | False | 2026-11-12 23:17:41.693+00:00 | 1 | 1 | 1 | None | None | None | 1 |
Appendix¶
Map the redun execution id¶
Export the run information from redun:
redun log --exec --exec-tag run=test-run --format json --no-pager > redun_exec.json
Map it on the run reference:
# load the redun execution id from the JSON and store it in the LaminDB run record
with open("redun_exec.json") as file:
redun_exec = json.loads(file.readline())
artifact.run.reference = redun_exec["id"]
artifact.run.reference_type = "redun_id"
artifact.run.save()
Show code cell output
Run(uid='MtLtHrj59VAf8DP6', name=None, description=None, entrypoint=None, started_at=2026-11-12 23:17:41 UTC, finished_at=2026-11-12 23:18:08 UTC, params=None, extra_data=None, reference='dab67087-d316-4470-a0f4-708fbb90086a', reference_type='redun_id', cli_args='run workflow.py main --input-dir ./fasta --tag run=test-run', branch_id=1, created_on_id=1, space_id=1, transform_id=1, report_id=7, environment_id=5, plan_id=None, created_by_id=1, initiated_by_run_id=None, created_at=2026-11-12 23:17:41 UTC, is_locked=False)
Map the redun run report¶
While lamindb auto-tracks the logs of the main python process you might also want to link the dedicated redun logs:
report = ln.Artifact(
"run_logs.txt",
description=f"Redun run report of {redun_exec['id']}",
run=False,
kind="__lamindb_run__", # mark as auxiliary artifact for the run
).save()
artifact.run.report = report
artifact.run.save()
Show code cell output
Run(uid='MtLtHrj59VAf8DP6', name=None, description=None, entrypoint=None, started_at=2026-11-12 23:17:41 UTC, finished_at=2026-11-12 23:18:08 UTC, params=None, extra_data=None, reference='dab67087-d316-4470-a0f4-708fbb90086a', reference_type='redun_id', cli_args='run workflow.py main --input-dir ./fasta --tag run=test-run', branch_id=1, created_on_id=1, space_id=1, transform_id=1, report_id=8, environment_id=5, plan_id=None, created_by_id=1, initiated_by_run_id=None, created_at=2026-11-12 23:17:41 UTC, is_locked=False)