Transfer artifacts from a local instance to a cloud instance¶
import lamindb as ln
import bionty as bt
ln.connect("laminlabs/lamin-dev")
bt.settings.organism = "human"
! schema module 'clinicore' is not installed → no access to its labels & registries (resolve via `pip install clinicore`)
Show code cell content
def cleanup(artifact: ln.Artifact):
features_sets = artifact.feature_sets.all()
experiments = artifact.experiments.all()
artifact.delete(permanent=True, storage=False)
features_sets.delete()
experiments.delete()
artifacts = ln.Artifact.filter(description="test-transfer-to-cloud").all()
for artifact in artifacts:
cleanup(artifact)
→ a file/folder remains here: /home/runner/work/lamindb/lamindb/docs/storage/test-transfer-to-cloud/.lamindb/UlbhiKWvh9Kd7shd0000.parquet
artifact = ln.Artifact.using("testuser1/test-transfer-to-cloud").get(
description="test-transfer-to-cloud"
)
artifact.describe()
Artifact .parquet/DataFrame ├── General │ ├── .uid = 'ISzq3dRK5RPMAnq70000' │ ├── .size = 1562 │ ├── .hash = 'K83d029Ts8xNMSUGfpuOqg' │ ├── .path = │ │ /home/runner/work/lamindb/lamindb/docs/storage/test-transfer-to-cloud/.lamindb/ISzq3dRK5RPMAnq70000.parquet │ ├── .created_by = testuser1 (Test User1) │ └── .created_at = 2025-01-12 14:03:54 ├── Dataset features/.feature_sets │ └── var • 2 [bionty.CellMarker] │ PD1 num │ CD21 num └── Labels └── .organisms bionty.Organism human .experiments wetlab.Experiment experiment-test-transfer-to-cloud
artifact.save()
! no run & transform got linked, call `ln.track()` & re-run
→ mapped records: Organism(uid='1dpCL6Td')
→ transferred records: Artifact(uid='ISzq3dRK5RPMAnq70000'), Experiment(uid='PjvCvUKt')
Artifact(uid='ISzq3dRK5RPMAnq70000', is_latest=True, description='test-transfer-to-cloud', suffix='.parquet', kind='dataset', otype='DataFrame', size=1562, hash='K83d029Ts8xNMSUGfpuOqg', space_id=1, storage_id=3, run_id=178, created_by_id=2, created_at=2025-01-12 14:04:02 UTC)
artifact.describe()
Artifact .parquet/DataFrame ├── General │ ├── .uid = 'ISzq3dRK5RPMAnq70000' │ ├── .size = 1562 │ ├── .hash = 'K83d029Ts8xNMSUGfpuOqg' │ ├── .path = │ │ /home/runner/work/lamindb/lamindb/docs/storage/test-transfer-to-cloud/.lamindb/ISzq3dRK5RPMAnq70000.parquet │ ├── .created_by = testuser1 (Test User1) │ ├── .created_at = 2025-01-12 14:04:02 │ └── .transform = 'Transfer from `testuser1/test-transfer-to-cloud`' ├── Dataset features/.feature_sets │ └── var • 2 [bionty.CellMarker] │ CD21 num │ PD1 num └── Labels └── .organisms bionty.Organism human .experiments wetlab.Experiment experiment-test-transfer-to-cloud
assert artifact._state.db == "default"
assert artifact.organisms.get().name == "human"
assert artifact.experiments.get().name == "experiment-test-transfer-to-cloud"
assert artifact.features["var"].count() == 2
!lamin delete --force test-transfer-to-cloud
!rm -r ./test-transfer-to-cloud
╭─ Error ──────────────────────────────────────────────────────────────────────╮
│ Storage │
│ '/home/runner/work/lamindb/lamindb/docs/storage/test-transfer-to-cloud/.lami │
│ ndb' contains 1 objects - delete them prior to deleting the instance │
╰──────────────────────────────────────────────────────────────────────────────╯