Can I disable tracking run inputs?#

Yes, if you switch track_run_inputs to False.

Setup#

!lamin init --storage test-run-inputs
Hide code cell output
✅ saved: User(uid='DzTjkKse', handle='testuser1', name='Test User1', updated_at=2024-03-04 13:55:38 UTC)
✅ saved: Storage(uid='LYmjZuwa', root='/home/runner/work/lamindb/lamindb/docs/faq/test-run-inputs', type='local', updated_at=2024-03-04 13:55:38 UTC, created_by_id=1)
💡 loaded instance: testuser1/test-run-inputs
💡 did not register local instance on lamin.ai
import lamindb as ln
💡 lamindb instance: testuser1/test-run-inputs

Some test artifacts:

ln.track(ln.Transform(name="Dummpy pipeline"))
ln.Artifact(ln.core.datasets.file_jpg_paradisi05(), description="My image").save()
ln.Artifact(ln.core.datasets.file_mini_csv(), description="My csv").save()
💡 saved: Transform(uid='bPyNPTv3OLJAhbTm', name='Dummpy pipeline', type=notebook, updated_at=2024-03-04 13:55:39 UTC, created_by_id=1)
💡 saved: Run(uid='tYxQk9sciodSBC0Z0jcY', run_at=2024-03-04 13:55:39 UTC, transform_id=1, created_by_id=1)

Call ln.track():

ln.transform.stem_uid = "Rx2s9aPTMQLY"
ln.transform.version = "1"
ln.track()
💡 notebook imports: lamindb==0.68.0
💡 saved: Transform(uid='Rx2s9aPTMQLY5zKv', name='Can I disable tracking run inputs?', short_name='track-run-inputs', version='1', type=notebook, updated_at=2024-03-04 13:55:42 UTC, created_by_id=1)
💡 saved: Run(uid='qRIDaxlCuF6xKzumUpxp', run_at=2024-03-04 13:55:42 UTC, transform_id=2, created_by_id=1)

Don’t track artifact as run input#

ln.settings.track_run_inputs = False
artifact = ln.Artifact.filter(description="My image").one()
artifact.stage()
PosixUPath('/home/runner/work/lamindb/lamindb/docs/faq/test-run-inputs/.lamindb/PnvT3DDjq52aJo95amRf.jpg')

No run inputs are linked to the current notebook run:

ln.Run.filter(id=ln.run_context.run.id).one().input_artifacts.all()
<QuerySet []>
Hide code cell content
assert len(ln.Run.filter(id=ln.run_context.run.id).one().input_artifacts.all()) == 0

Manually track artifact as run input#

Let us manually track an artifact by passing is_run_input to either .stage(), .load() or .backed():

artifact.stage(is_run_input=True)
PosixUPath('/home/runner/work/lamindb/lamindb/docs/faq/test-run-inputs/.lamindb/PnvT3DDjq52aJo95amRf.jpg')

You can see the fcs artifact is now being added to the run inputs:

for input in ln.Run.filter(id=ln.run_context.run.id).one().input_artifacts.all():
    print(input)
Artifact(uid='PnvT3DDjq52aJo95amRf', suffix='.jpg', description='My image', size=29358, hash='r4tnqmKI_SjrkdLzpuWp4g', hash_type='md5', visibility=1, key_is_virtual=True, updated_at=2024-03-04 13:55:40 UTC, storage_id=1, transform_id=1, run_id=1, created_by_id=1)
Hide code cell content
assert len(ln.Run.filter(id=ln.run_context.run.id).one().input_artifacts.all()) == 1

Automatically track artifacts as run input#

If you switch the following setting, and call to .load(), .stage() and .backed() will track the artifact as run input.

ln.settings.track_run_inputs = True
artifact = ln.Artifact.filter(description="My csv").one()
artifact.load()
test
0 1
1 2
2 3
for input in ln.Run.filter(id=ln.run_context.run.id).one().input_artifacts.all():
    print(input)
Artifact(uid='PnvT3DDjq52aJo95amRf', suffix='.jpg', description='My image', size=29358, hash='r4tnqmKI_SjrkdLzpuWp4g', hash_type='md5', visibility=1, key_is_virtual=True, updated_at=2024-03-04 13:55:40 UTC, storage_id=1, transform_id=1, run_id=1, created_by_id=1)
Artifact(uid='xdSpkynAEVzgzJ3xNYwl', suffix='.csv', description='My csv', size=11, hash='z1LdF2qN4cN0M2sXrcW8aw', hash_type='md5', visibility=1, key_is_virtual=True, updated_at=2024-03-04 13:55:40 UTC, storage_id=1, transform_id=1, run_id=1, created_by_id=1)
Hide code cell content
assert len(ln.Run.filter(id=ln.run_context.run.id).one().input_artifacts.all()) == 2
Hide code cell content
!lamin delete --force test-run-inputs
💡 deleting instance testuser1/test-run-inputs
✅     deleted instance settings file: /home/runner/.lamin/instance--testuser1--test-run-inputs.env
✅     instance cache deleted
✅     deleted '.lndb' sqlite file
❗     consider manually deleting your stored data: /home/runner/work/lamindb/lamindb/docs/faq/test-run-inputs