Can I disable tracking run inputs?#
Yes, if you switch track_run_inputs
to False
.
!lamin init --storage test-run-inputs
✅ saved: User(id='DzTjkKse', handle='testuser1', email='testuser1@lamin.ai', name='Test User1', updated_at=2023-09-26 15:21:48)
✅ saved: Storage(id='PQafK5EH', root='/home/runner/work/lamindb/lamindb/docs/faq/test-run-inputs', type='local', updated_at=2023-09-26 15:21:48, created_by_id='DzTjkKse')
💡 loaded instance: testuser1/test-run-inputs
💡 did not register local instance on hub (if you want, call `lamin register`)
import lamindb as ln
💡 loaded instance: testuser1/test-run-inputs (lamindb 0.54.2)
Some test files:
ln.track(ln.Transform(name="Dummpy pipeline"))
ln.File(ln.dev.datasets.file_jpg_paradisi05(), description="My image").save()
ln.File(ln.dev.datasets.file_mini_csv(), description="My csv").save()
💡 Transform(id='RfpuVRYSIYJQML', name='Dummpy pipeline', type=notebook, updated_at=2023-09-26 15:21:49, created_by_id='DzTjkKse')
💡 Run(id='YXIJhMuGXQSkjotnes0k', run_at=2023-09-26 15:21:49, transform_id='RfpuVRYSIYJQML', created_by_id='DzTjkKse')
Call ln.track()
:
ln.track()
💡 notebook imports: lamindb==0.54.2
💡 Transform(id='Rx2s9aPTMQLYz8', name='Can I disable tracking run inputs?', short_name='track-run-inputs', version='0', type=notebook, updated_at=2023-09-26 15:21:50, created_by_id='DzTjkKse')
💡 Run(id='qHJp2T44C1MyhvZ4I2Xo', run_at=2023-09-26 15:21:50, transform_id='Rx2s9aPTMQLYz8', created_by_id='DzTjkKse')
Don’t track file as run input#
ln.settings.track_run_inputs = False
file = ln.File.filter(description="My image").one()
file.stage()
PosixUPath('/home/runner/work/lamindb/lamindb/docs/faq/test-run-inputs/.lamindb/YznOWC4ozfOrLIdf771r.jpg')
No run inputs are linked to the current notebook run:
ln.Run.filter(id=ln.run_context.run.id).one().input_files.all()
<QuerySet []>
Show code cell content
assert len(ln.Run.filter(id=ln.run_context.run.id).one().input_files.all()) == 0
Manually track file as run input with is_run_input=True
#
Let us manually track a file by passing is_run_input
to either .stage()
, .load()
or .backed()
:
file.stage(is_run_input=True)
PosixUPath('/home/runner/work/lamindb/lamindb/docs/faq/test-run-inputs/.lamindb/YznOWC4ozfOrLIdf771r.jpg')
You can see the fcs file is now being added to the run inputs:
for input in ln.Run.filter(id=ln.run_context.run.id).one().input_files.all():
print(input)
File(id='YznOWC4ozfOrLIdf771r', suffix='.jpg', description='My image', size=29358, hash='r4tnqmKI_SjrkdLzpuWp4g', hash_type='md5', updated_at=2023-09-26 15:21:50, storage_id='PQafK5EH', transform_id='RfpuVRYSIYJQML', run_id='YXIJhMuGXQSkjotnes0k', created_by_id='DzTjkKse')
Show code cell content
assert len(ln.Run.filter(id=ln.run_context.run.id).one().input_files.all()) == 1
Automatically track files as run input#
If you switch the following setting, and call to .load()
, .stage()
and .backed()
will track the file as run input.
ln.settings.track_run_inputs = True
file = ln.File.filter(description="My csv").one()
file.load()
test | |
---|---|
0 | 1 |
1 | 2 |
2 | 3 |
for input in ln.Run.filter(id=ln.run_context.run.id).one().input_files.all():
print(input)
File(id='YznOWC4ozfOrLIdf771r', suffix='.jpg', description='My image', size=29358, hash='r4tnqmKI_SjrkdLzpuWp4g', hash_type='md5', updated_at=2023-09-26 15:21:50, storage_id='PQafK5EH', transform_id='RfpuVRYSIYJQML', run_id='YXIJhMuGXQSkjotnes0k', created_by_id='DzTjkKse')
File(id='7PIuC1ADyLUUCXwU8MM4', suffix='.csv', description='My csv', size=11, hash='z1LdF2qN4cN0M2sXrcW8aw', hash_type='md5', updated_at=2023-09-26 15:21:50, storage_id='PQafK5EH', transform_id='RfpuVRYSIYJQML', run_id='YXIJhMuGXQSkjotnes0k', created_by_id='DzTjkKse')
Show code cell content
assert len(ln.Run.filter(id=ln.run_context.run.id).one().input_files.all()) == 2
Show 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