Redun

Here, we’ll see how to track redun workflow runs with LaminDB.

Note

This use case is based on github.com/ricomnl/bioinformatics-pipeline-tutorial.

# pip install lamindb redun git+http://github.com/laminlabs/redun-lamin-fasta
!lamin init --storage ./test-redun-lamin
Hide code cell output
 initialized lamindb: testuser1/test-redun-lamin

Amend the workflow

import lamindb as ln
import json
Hide code cell output
 connected lamindb: testuser1/test-redun-lamin

Let’s amend a redun workflow.py to register input & output artifacts in LaminDB:

  • To track the workflow run in LaminDB, add (see on GitHub):

    ln.track(params=params)
    
  • To register the output file via LaminDB, add (see on GitHub):

    ln.Artifact(output_path, description="results").save()
    

Run redun

Let’s see what the input files are:

!ls ./fasta
Hide code cell output
KLF4.fasta  MYC.fasta  PO5F1.fasta  SOX2.fasta

And call the 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
Hide code cell output
 connected lamindb: testuser1/test-redun-lamin
 created Transform('HbTtvZFSPzHD0000'), started new Run('8d2GlAv9...') at 2025-06-03 11:33:15 UTC
→ params: input_dir=./fasta, amino_acid=C, enzyme_regex=[KR], missed_cleavages=0, min_length=4, max_length=75, executor=Executor.default
 recommendation: to identify the script across renames, pass the uid: ln.track("HbTtvZFSPzHD", params={...})
! folder i[redun] Run    Job 4a6f98e4:  bioinformatics_pipeline_tutorial.lib.digest_protein_task(input_fasta=File(path=/home/runner/work/redun-lamin/ finished Run('8d2GlAv9') after 5s at 2025-06-03 11:33:21 UTC
File(path=/home/runner/work/redun-lamin/redun-lamin/docs/test-redun-lamin/data/results.tgz, hash=d55f2568)
  Job b16c901c:  bioinformatics_pipeline_tutorial.lib.digest_protein_task(input_fasta=File(path=/home/runner/work/redun-lamin/redun-lamin/docs/test-redun-lamin/.lamindb/GKJHSjbhrGeYXC4w0000.fasta, hash=8203aa0f), enzyme_regex='[KR]', missed_cleavages=0, min_length=4, max_length=75) on default
[redun] Run    Job f41e864c:  bioinformatics_pipeline_tutorial.lib.digest_protein_task(input_fasta=File(path=/home/runner/work/redun-lamin/redun-lamin/docs/test-redun-lamin/.lamindb/q8dS5YKudx54PfoG0000.fasta, hash=1d037baa), enzyme_regex='[KR]', missed_cleavages=0, min_length=4, max_length=75) on default
[redun] Run    Job 705b9ab7:  bioinformatics_pipeline_tutorial.lib.digest_protein_task(input_fasta=File(path=/home/runner/work/redun-lamin/redun-lamin/docs/test-redun-lamin/.lamindb/CzfojJdi5A1xEqxI0000.fasta, hash=186de01c), enzyme_regex='[KR]', missed_cleavages=0, min_length=4, max_length=75) on default
[redun] Run    Job 239c5179:  bioinformatics_pipeline_tutorial.lib.count_amino_acids_task(input_fasta=File(path=/home/runner/work/redun-lamin/redun-lamin/docs/test-redun-lamin/.lamindb/5RNv7y6BaPFE2m2E0000.fasta, hash=673ebe4e), input_peptides=File(path=/home/runner/work/redun-lamin/redun-lamin/docs/test-redun-lamin/data/5RNv7y6BaPFE2m2E0000.peptides.txt, hash=99227117), amino_acid='C') on default
[redun] Run    Job e7c73f56:  bioinformatics_pipeline_tutorial.lib.count_amino_acids_task(input_fasta=File(path=/home/runner/work/redun-lamin/redun-lamin/docs/test-redun-lamin/.lamindb/GKJHSjbhrGeYXC4w0000.fasta, hash=8203aa0f), input_peptides=File(path=/home/runner/work/redun-lamin/redun-lamin/docs/test-redun-lamin/data/GKJHSjbhrGeYXC4w0000.peptides.txt, hash=f8cd0794), amino_acid='C') on default
[redun] Run    Job ee26fec5:  bioinformatics_pipeline_tutorial.lib.count_amino_acids_task(input_fasta=File(path=/home/runner/work/redun-lamin/redun-lamin/docs/test-redun-lamin/.lamindb/q8dS5YKudx54PfoG0000.fasta, hash=1d037baa), input_peptides=File(path=/home/runner/work/redun-lamin/redun-lamin/docs/test-redun-lamin/data/q8dS5YKudx54PfoG0000.peptides.txt, hash=bed48b67), amino_acid='C') on default
[redun] Run    Job ce93eef0:  bioinformatics_pipeline_tutorial.lib.count_amino_acids_task(input_fasta=File(path=/home/runner/work/redun-lamin/redun-lamin/docs/test-redun-lamin/.lamindb/CzfojJdi5A1xEqxI0000.fasta, hash=186de01c), input_peptides=File(path=/home/runner/work/redun-lamin/redun-lamin/docs/test-redun-lamin/data/CzfojJdi5A1xEqxI0000.peptides.txt, hash=db7d2268), amino_acid='C') on default
[redun] Run    Job a69ca342:  bioinformatics_pipeline_tutorial.lib.plot_count_task(input_count=File(path=/home/runner/work/redun-lamin/redun-lamin/docs/test-redun-lamin/data/5RNv7y6BaPFE2m2E0000.count.tsv, hash=c78d2161)) on default
[redun] Run    Job d81c21b1:  bioinformatics_pipeline_tutorial.lib.plot_count_task(input_count=File(path=/home/runner/work/redun-lamin/redun-lamin/docs/test-redun-lamin/data/GKJHSjbhrGeYXC4w0000.count.tsv, hash=95ad9021)) on default
[redun] Run    Job d21d43bb:  bioinformatics_pipeline_tutorial.lib.plot_count_task(input_count=File(path=/home/runner/work/redun-lamin/redun-lamin/docs/test-redun-lamin/data/q8dS5YKudx54PfoG0000.count.tsv, hash=1d3e627f)) on default
[redun] Run    Job c4fef3df:  bioinformatics_pipeline_tutorial.lib.plot_count_task(input_count=File(path=/home/runner/work/redun-lamin/redun-lamin/docs/test-redun-lamin/data/CzfojJdi5A1xEqxI0000.count.tsv, hash=b1dab632)) on default
[redun] Run    Job 328ba69f:  bioinformatics_pipeline_tutorial.lib.get_report_task(input_counts=[File(path=/home/runner/work/redun-lamin/redun-lamin/docs/test-redun-lamin/data/5RNv7y6BaPFE2m2E0000.count.tsv, hash=c78d2161), File(path=/home/runner/work/redun-lamin/redun-lamin/docs/test-redun-l...) on default
[redun] Run    Job 3d7456cd:  bioinformatics_pipeline_tutorial.lib.archive_results_task(inputs_plots=[File(path=/home/runner/work/redun-lamin/redun-lamin/docs/test-redun-lamin/data/5RNv7y6BaPFE2m2E0000.plot.png, hash=7326aa0d), 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=71ade92d)) on default
[redun] Run    Job 3ca254cb:  redun_lamin_fasta.finish(results_archive=File(path=/home/runner/work/redun-lamin/redun-lamin/docs/test-redun-lamin/data/results.tgz, hash=d55f2568)) on default
[redun] 
[redun] | JOB STATUS 2025/06/03 11:33:21
[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_report_task              0       0       0       0       1       1
[redun] | bioinformatics_pipeline_tutorial.lib.plot_count_task              0       0       0       0       4       4
[redun] | redun_lamin_fasta.finish                                          0       0       0       0       1       1
[redun] | redun_lamin_fasta.main                                            0       0       0       0       1       1
[redun] 
[redun] 
[redun] Execution duration: 6.02 seconds

View data lineage:

artifact = ln.Artifact.get(key="data/results.tgz")
artifact.view_lineage()
Hide code cell output
_images/21cf2a4737e33c6d8caf754b244a87a9b694e85a2344a3961c47f07f5b62d037.svg

Track the redun execution id

If we want to be able to query LaminDB for redun execution ID, this here is a way to get it:

# export the run information from redun
!redun log --exec --exec-tag run=test-run --format json --no-pager > redun_exec.json
# 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()
Run(uid='8d2GlAv9LUnA8ffW', started_at=2025-06-03 11:33:15 UTC, finished_at=2025-06-03 11:33:21 UTC, reference='563ec7b4-cf07-4b29-9e64-fbe19d378b34', reference_type='redun_id', branch_id=1, space_id=1, transform_id=1, report_id=7, environment_id=6, created_by_id=1, created_at=2025-06-03 11:33:15 UTC)

Track the redun run report

Attach a run report:

report = ln.Artifact(
    "run_logs.txt",
    description=f"Redun run report of {redun_exec['id']}",
    run=False,
    visibility=0,
).save()
artifact.run.report = report
artifact.run.save()
Run(uid='8d2GlAv9LUnA8ffW', started_at=2025-06-03 11:33:15 UTC, finished_at=2025-06-03 11:33:21 UTC, reference='563ec7b4-cf07-4b29-9e64-fbe19d378b34', reference_type='redun_id', branch_id=1, space_id=1, transform_id=1, report_id=8, environment_id=6, created_by_id=1, created_at=2025-06-03 11:33:15 UTC)

View transforms and runs in LaminHub

hub

View the database content

ln.view()
Hide code cell output
Artifact
uid key description suffix kind otype size hash n_files n_observations _hash_type _key_is_virtual _overwrite_versions space_id storage_id schema_id version is_latest run_id created_at created_by_id _aux branch_id
id
8 V1SaYTVAmbtGAnbA0000 None Redun run report of 563ec7b4-cf07-4b29-9e64-fb... .txt None None 6335 E9WAu-H5XadPHKMx15_a-g None None md5 True False 1 1 None None True NaN 2025-06-03 11:33:25.588000+00:00 1 None 1
7 mSISzUSz3FLnaHhT0000 None log streams of run 8d2GlAv9LUnA8ffW .txt __lamindb_run__ None 0 1B2M2Y8AsgTpgAmY7PhCfg None None md5 True False 1 1 None None True NaN 2025-06-03 11:33:21.137000+00:00 1 None 1
6 jQ4r76xgNbmviEqT0000 None requirements.txt .txt __lamindb_run__ None 3199 vsG9AhFOE9HzvFSTWZ3-sA None None md5 True False 1 1 None None True NaN 2025-06-03 11:33:21.131000+00:00 1 None 1
5 r6HCsLemQJ9jtKlb0000 data/results.tgz None .tgz None None 83523 9qZX3m6HiDfUSdzFLWcnCg None None md5 False False 1 1 None None True 1.0 2025-06-03 11:33:21.071000+00:00 1 None 1
4 CzfojJdi5A1xEqxI0000 fasta/MYC.fasta None .fasta None None 536 WGbEtzPw-3bQEGcngO_pHQ None None md5 True False 1 1 None None True NaN 2025-06-03 11:33:18.201000+00:00 1 None 1
2 GKJHSjbhrGeYXC4w0000 fasta/SOX2.fasta None .fasta None None 414 C5q_yaFXGk4SAEpfdqBwnQ None None md5 True False 1 1 None None True NaN 2025-06-03 11:33:18.200000+00:00 1 None 1
3 q8dS5YKudx54PfoG0000 fasta/KLF4.fasta None .fasta None None 609 LyuoYkWs4SgYcH7P7JLJtA None None md5 True False 1 1 None None True NaN 2025-06-03 11:33:18.200000+00:00 1 None 1
Feature
uid name dtype is_type unit description array_rank array_size array_shape proxy_dtype synonyms _expect_many _curation space_id type_id run_id created_at created_by_id _aux branch_id
id
1 pPMUPo11Otjp input_dir str None None None 0 0 None None None None None 1 None None 2025-06-03 11:33:15.560000+00:00 1 {'af': {'0': None, '1': True, '2': False}} 1
2 6x4PhdlbbRog amino_acid str None None None 0 0 None None None None None 1 None None 2025-06-03 11:33:15.560000+00:00 1 {'af': {'0': None, '1': True, '2': False}} 1
3 2qrtGhlL6S7K enzyme_regex str None None None 0 0 None None None None None 1 None None 2025-06-03 11:33:15.560000+00:00 1 {'af': {'0': None, '1': True, '2': False}} 1
4 rDaFPTcb7Ky1 missed_cleavages int None None None 0 0 None None None None None 1 None None 2025-06-03 11:33:15.560000+00:00 1 {'af': {'0': None, '1': True, '2': False}} 1
5 uBEd0Sjy5HTP min_length int None None None 0 0 None None None None None 1 None None 2025-06-03 11:33:15.560000+00:00 1 {'af': {'0': None, '1': True, '2': False}} 1
6 AYuTwriiUYMd max_length int None None None 0 0 None None None None None 1 None None 2025-06-03 11:33:15.560000+00:00 1 {'af': {'0': None, '1': True, '2': False}} 1
7 4BjwAg9ueGZh executor str None None None 0 0 None None None None None 1 None None 2025-06-03 11:33:15.560000+00:00 1 {'af': {'0': None, '1': True, '2': False}} 1
FeatureValue
value hash space_id feature_id run_id created_at created_by_id _aux branch_id
id
1 ./fasta G8diGhDfCu78R1WbXfsHOw 1 1 None 2025-06-03 11:33:15.596000+00:00 1 None 1
2 C DWH4NwytHUEvgLhNFD4SVw 1 2 None 2025-06-03 11:33:15.598000+00:00 1 None 1
3 [KR] zPuapwAPylpfWRQFOTw9Cg 1 3 None 2025-06-03 11:33:15.600000+00:00 1 None 1
4 0 z80ghJXVZe9m59_5-Ydk2g 1 4 None 2025-06-03 11:33:15.602000+00:00 1 None 1
5 4 qH_2eaLz5x2RgaZ7dUISLA 1 5 None 2025-06-03 11:33:15.604000+00:00 1 None 1
6 75 0Jv0FUSjNlpGyQd-u141ww 1 6 None 2025-06-03 11:33:15.607000+00:00 1 None 1
7 Executor.default BaNJiQQLvaFrvOtdglHU7w 1 7 None 2025-06-03 11:33:15.609000+00:00 1 None 1
Run
uid name started_at finished_at reference reference_type _is_consecutive _status_code space_id transform_id report_id _logfile_id environment_id initiated_by_run_id created_at created_by_id _aux branch_id
id
1 8d2GlAv9LUnA8ffW None 2025-06-03 11:33:15.577513+00:00 2025-06-03 11:33:21.133532+00:00 563ec7b4-cf07-4b29-9e64-fbe19d378b34 redun_id True 0 1 1 8 None 6 None 2025-06-03 11:33:15.578000+00:00 1 None 1
Storage
uid root description type region instance_uid space_id run_id created_at created_by_id _aux branch_id
id
1 Ceh2Hyk3e54n /home/runner/work/redun-lamin/redun-lamin/docs... None local None iQlBPgD8uaqR 1 None 2025-06-03 11:32:57.891000+00:00 1 None 1
Transform
uid key description type source_code hash reference reference_type space_id _template_id version is_latest created_at created_by_id _aux branch_id
id
1 HbTtvZFSPzHD0000 workflow.py workflow.py script """workflow.py."""\n\n# This code is a copy fr... mHyxrE622q2fluxICu4XDw None None 1 None None True 2025-06-03 11:33:15.575000+00:00 1 None 1

Delete the test instance:

Hide code cell content
!rm -rf test-redun-lamin
!lamin delete --force test-redun-lamin
 deleting instance testuser1/test-redun-lamin