lamindb.track

lamindb.track(*, params=None, transform=None, new_run=None, path=None)

Track notebook or script run.

Creates or loads a global Run that enables data lineage tracking. You can find it in run_context.

Saves source code and compute environment.

If sync_git_repo is set, will first check whether the script exists in the git repository and add a link.

Parameters:
  • params (dict | None, default: None) – A dictionary of parameters to track for the run.

  • transform (Transform | None, default: None) – Can be of type "pipeline" or "notebook" (TransformType).

  • new_run (bool | None, default: None) – If False, loads latest run of transform (default notebook), if True, creates new run (default pipeline).

  • path (str | None, default: None) – Filepath of notebook or script. Only needed if it can’t be automatically detected.

Return type:

Run

Examples

To track a notebook or script, call:

>>> import lamindb as ln
>>> ln.track()

If you’d like to track an abstract pipeline run, 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=transform)