lamindb.track#
- lamindb.track(transform=None, *, new_run=None, reference=None, reference_type=None, notebook_path=None, pypackage=None, editor=None)#
Track global Transform & Run for a notebook or pipeline.
Creates or loads a
Run
record and sets a globalrun_context
.In a Jupyter notebook, call without any argument (metadata is parsed). If the notebook has no associated metadata (“is not initialized”), attempts to write metadata to disk. If it fails to so interactively, it will ask you to leverage the CLI.
- Parameters:
transform (
Optional
[Transform
], default:None
) – Can be of type “pipeline” or “notebook” (TransformType
).new_run (
Optional
[bool
], default:None
) – If False, loads latest run of transform (default notebook), if True, creates new run (default pipeline).reference (
Optional
[str
], default:None
) – Reference to pass toRun
record.reference_type (
Optional
[str
], default:None
) – Reference type to pass toRun
record (e.g. “url”).notebook_path (
Optional
[str
], default:None
) – Filepath of notebook. Only needed if inference fails.pypackage (
Union
[str
,List
[str
],None
], default:None
) – One or more python packages for which to parse versions.editor (
Optional
[str
], default:None
) – Editor environment. Pass ‘lab’ for jupyter lab and ‘notebook’ for jupyter notebook, this can help to identify the correct mechanism for interactivity when automatic inference fails.
- Return type:
None
Examples
If you’re in a Jupyter notebook and installed lamindb with pip install[jupyter], you can simply call:
>>> ln.track() >>> ln.dev.run_context.transform >>> ln.dev.run_context.run
If you’d like to track a pipeline, pass a
Transform
object of type “pipeline”:>>> ln.Transform(name="Cell Ranger", version="2", type="pipeline").save() >>> transform = ln.Transform.filter(name="Cell Ranger", version="2").one() >>> ln.track(transform)