lamindb_setup 0.76.5__py2.py3-none-any.whl → 0.76.6__py2.py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- lamindb_setup/__init__.py +1 -1
- lamindb_setup/_set_managed_storage.py +3 -3
- lamindb_setup/core/_hub_core.py +5 -5
- lamindb_setup/core/_settings_storage.py +9 -5
- {lamindb_setup-0.76.5.dist-info → lamindb_setup-0.76.6.dist-info}/METADATA +1 -1
- {lamindb_setup-0.76.5.dist-info → lamindb_setup-0.76.6.dist-info}/RECORD +8 -8
- {lamindb_setup-0.76.5.dist-info → lamindb_setup-0.76.6.dist-info}/LICENSE +0 -0
- {lamindb_setup-0.76.5.dist-info → lamindb_setup-0.76.6.dist-info}/WHEEL +0 -0
lamindb_setup/__init__.py
CHANGED
|
@@ -30,8 +30,8 @@ def set_managed_storage(root: UPathStr, **fs_kwargs):
|
|
|
30
30
|
"Can't add additional managed storage locations for instances that aren't managed through the hub."
|
|
31
31
|
)
|
|
32
32
|
# here the storage is registered in the hub
|
|
33
|
-
# hub_record_status="
|
|
34
|
-
# "
|
|
33
|
+
# hub_record_status="hub-record-created" if a new record is created
|
|
34
|
+
# "hub-record-retireved" if the storage is in the hub already
|
|
35
35
|
ssettings, hub_record_status = init_storage(
|
|
36
36
|
root=root, instance_id=settings.instance._id, register_hub=True
|
|
37
37
|
)
|
|
@@ -46,7 +46,7 @@ def set_managed_storage(root: UPathStr, **fs_kwargs):
|
|
|
46
46
|
try:
|
|
47
47
|
register_storage_in_instance(ssettings)
|
|
48
48
|
except Exception as e:
|
|
49
|
-
if hub_record_status == "
|
|
49
|
+
if hub_record_status == "hub-record-created" and ssettings._uuid is not None:
|
|
50
50
|
delete_storage_record(ssettings._uuid) # type: ignore
|
|
51
51
|
raise e
|
|
52
52
|
|
lamindb_setup/core/_hub_core.py
CHANGED
|
@@ -119,7 +119,7 @@ def _select_storage(
|
|
|
119
119
|
def init_storage(
|
|
120
120
|
ssettings: StorageSettings,
|
|
121
121
|
auto_populate_instance: bool = True,
|
|
122
|
-
) -> Literal["
|
|
122
|
+
) -> Literal["hub-record-retireved", "hub-record-created"]:
|
|
123
123
|
if settings.user.handle != "anonymous":
|
|
124
124
|
return call_with_fallback_auth(
|
|
125
125
|
_init_storage,
|
|
@@ -131,21 +131,21 @@ def init_storage(
|
|
|
131
131
|
_select_storage, ssettings=ssettings, update_uid=True
|
|
132
132
|
)
|
|
133
133
|
if storage_exists:
|
|
134
|
-
return "
|
|
134
|
+
return "hub-record-retireved"
|
|
135
135
|
else:
|
|
136
136
|
raise ValueError("Log in to create a storage location on the hub.")
|
|
137
137
|
|
|
138
138
|
|
|
139
139
|
def _init_storage(
|
|
140
140
|
ssettings: StorageSettings, auto_populate_instance: bool, client: Client
|
|
141
|
-
) -> Literal["
|
|
141
|
+
) -> Literal["hub-record-retireved", "hub-record-created"]:
|
|
142
142
|
from lamindb_setup import settings
|
|
143
143
|
|
|
144
144
|
# storage roots are always stored without the trailing slash in the SQL
|
|
145
145
|
# database
|
|
146
146
|
root = ssettings.root_as_str
|
|
147
147
|
if _select_storage(ssettings, update_uid=True, client=client):
|
|
148
|
-
return "
|
|
148
|
+
return "hub-record-retireved"
|
|
149
149
|
if ssettings.type_is_cloud:
|
|
150
150
|
id = uuid.uuid5(uuid.NAMESPACE_URL, root)
|
|
151
151
|
else:
|
|
@@ -181,7 +181,7 @@ def _init_storage(
|
|
|
181
181
|
# on root & description
|
|
182
182
|
client.table("storage").upsert(fields).execute()
|
|
183
183
|
ssettings._uuid_ = id
|
|
184
|
-
return "
|
|
184
|
+
return "hub-record-created"
|
|
185
185
|
|
|
186
186
|
|
|
187
187
|
def delete_instance(identifier: UUID | str, require_empty: bool = True) -> str | None:
|
|
@@ -85,11 +85,15 @@ def init_storage(
|
|
|
85
85
|
init_instance: bool = False,
|
|
86
86
|
) -> tuple[
|
|
87
87
|
StorageSettings,
|
|
88
|
-
Literal["
|
|
88
|
+
Literal["hub-record-not-created", "hub-record-retireved", "hub-record-created"],
|
|
89
89
|
]:
|
|
90
90
|
if root is None:
|
|
91
91
|
raise ValueError("`storage` argument can't be `None`")
|
|
92
92
|
root_str = str(root) # ensure we have a string
|
|
93
|
+
if ".lamindb" in root_str:
|
|
94
|
+
raise ValueError(
|
|
95
|
+
'Please pass a folder name that does not end or contain ".lamindb"'
|
|
96
|
+
)
|
|
93
97
|
uid = base62(12)
|
|
94
98
|
region = None
|
|
95
99
|
lamin_env = os.getenv("LAMIN_ENV")
|
|
@@ -122,8 +126,8 @@ def init_storage(
|
|
|
122
126
|
)
|
|
123
127
|
# this stores the result of init_storage_hub
|
|
124
128
|
hub_record_status: Literal[
|
|
125
|
-
"
|
|
126
|
-
] = "
|
|
129
|
+
"hub-record-not-created", "hub-record-retireved", "hub-record-created"
|
|
130
|
+
] = "hub-record-not-created"
|
|
127
131
|
# the below might update the uid with one that's already taken on the hub
|
|
128
132
|
if not prevent_register_hub:
|
|
129
133
|
if ssettings.type_is_cloud or register_hub:
|
|
@@ -146,7 +150,7 @@ def init_storage(
|
|
|
146
150
|
# _select_storage inside init_storage_hub also populates ssettings._uuid
|
|
147
151
|
# and we don't want to delete an existing storage record here
|
|
148
152
|
# only newly created
|
|
149
|
-
if hub_record_status == "
|
|
153
|
+
if hub_record_status == "hub-record-created" and ssettings._uuid is not None:
|
|
150
154
|
delete_storage_record(ssettings._uuid) # type: ignore
|
|
151
155
|
ssettings._instance_id = None
|
|
152
156
|
return ssettings, hub_record_status
|
|
@@ -184,7 +188,7 @@ class StorageSettings:
|
|
|
184
188
|
(self._root_init / ".lamindb").mkdir(parents=True, exist_ok=True)
|
|
185
189
|
self._root_init = self._root_init.resolve()
|
|
186
190
|
except Exception:
|
|
187
|
-
logger.warning("unable to create .lamindb folder")
|
|
191
|
+
logger.warning(f"unable to create .lamindb folder in {self._root_init}")
|
|
188
192
|
pass
|
|
189
193
|
self._root = None
|
|
190
194
|
self._instance_id = instance_id
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
lamindb_setup/__init__.py,sha256=
|
|
1
|
+
lamindb_setup/__init__.py,sha256=oS0T4Bi_gmUMhmQgSv_QLNn_UX7KoGP3pVyA6cv1XBI,1542
|
|
2
2
|
lamindb_setup/_cache.py,sha256=wA7mbysANwe8hPNbjDo9bOmXJ0xIyaS5iyxIpxSWji4,846
|
|
3
3
|
lamindb_setup/_check.py,sha256=28PcG8Kp6OpjSLSi1r2boL2Ryeh6xkaCL87HFbjs6GA,129
|
|
4
4
|
lamindb_setup/_check_setup.py,sha256=cNEL9Q4yPpmEkGKHH8JgullWl1VUZwALJ4RHn9wZypY,2613
|
|
@@ -13,7 +13,7 @@ lamindb_setup/_migrate.py,sha256=P4n3x0SYzO9szjF2-JMa7z4mQadtWjHv5ow4HbCDZLI,886
|
|
|
13
13
|
lamindb_setup/_register_instance.py,sha256=alQuYp2f8Ct8xvRC1gt8p_HZ0tqCd3gZD3kiPBLPpsI,1269
|
|
14
14
|
lamindb_setup/_schema.py,sha256=b3uzhhWpV5mQtDwhMINc2MabGCnGLESy51ito3yl6Wc,679
|
|
15
15
|
lamindb_setup/_schema_metadata.py,sha256=nF29OuMNswJUCyvSyOHEUQLQ7PcfB7uwvczloBYSWuU,13187
|
|
16
|
-
lamindb_setup/_set_managed_storage.py,sha256=
|
|
16
|
+
lamindb_setup/_set_managed_storage.py,sha256=4tDxXQMt8Gw028uY3vIQxZQ7qBNXhQMc8saarNK_Z-s,2043
|
|
17
17
|
lamindb_setup/_setup_user.py,sha256=6Oc7Rke-yRQSZbuntdUAz8QbJ6UuPzYHI9FnYlf_q-A,3670
|
|
18
18
|
lamindb_setup/_silence_loggers.py,sha256=AKF_YcHvX32eGXdsYK8MJlxEaZ-Uo2f6QDRzjKFCtws,1568
|
|
19
19
|
lamindb_setup/core/__init__.py,sha256=BxIVMX5HQq8oZ1OuY_saUEJz5Tdd7gaCPngxVu5iou4,417
|
|
@@ -22,7 +22,7 @@ lamindb_setup/core/_aws_storage.py,sha256=nEjeUv4xUVpoV0Lx-zjjmyb9w804bDyaeiM-Oq
|
|
|
22
22
|
lamindb_setup/core/_deprecated.py,sha256=3qxUI1dnDlSeR0BYrv7ucjqRBEojbqotPgpShXs4KF8,2520
|
|
23
23
|
lamindb_setup/core/_docs.py,sha256=3k-YY-oVaJd_9UIY-LfBg_u8raKOCNfkZQPA73KsUhs,276
|
|
24
24
|
lamindb_setup/core/_hub_client.py,sha256=Gpt3TmxWQMVenKugCu1agUb-xGN9YFsQOKmrHuFiiDs,5605
|
|
25
|
-
lamindb_setup/core/_hub_core.py,sha256=
|
|
25
|
+
lamindb_setup/core/_hub_core.py,sha256=2Ni7vIkUcZw9ryBLgjercvLsdAL8-3xZNmrxyzNCU98,17049
|
|
26
26
|
lamindb_setup/core/_hub_crud.py,sha256=eZErpq9t1Cp2ULBSi457ekrcqfesw4Y6IJgaqyrINMY,5276
|
|
27
27
|
lamindb_setup/core/_hub_utils.py,sha256=w5IRtrxZcvxmGSJslzuZF89ewkzXV4cCUmZUVrqmAfo,3026
|
|
28
28
|
lamindb_setup/core/_private_django_api.py,sha256=KIn43HOhiRjkbTbddyJqv-WNTTa1bAizbM1tWXoXPBg,2869
|
|
@@ -30,7 +30,7 @@ lamindb_setup/core/_settings.py,sha256=46axQ5HPvI0X9YuotgdpuSOfSo7qYU1DudIx3vxpF
|
|
|
30
30
|
lamindb_setup/core/_settings_instance.py,sha256=azgqSWEnTfZM9ghgdF6atvIxoUP6fx49Y9tZTqMQTuc,17589
|
|
31
31
|
lamindb_setup/core/_settings_load.py,sha256=bRkGgaEnLZmnOlU5ptDoSM-YXzC2l0Cb7RBoBY6VH9k,3717
|
|
32
32
|
lamindb_setup/core/_settings_save.py,sha256=n_tYfb9EBSxwm4LHyPRHJptE5uB8lmHhcRkz1JkAmhg,2781
|
|
33
|
-
lamindb_setup/core/_settings_storage.py,sha256=
|
|
33
|
+
lamindb_setup/core/_settings_storage.py,sha256=jFdoIkSn1gPDDZKjAlgKyrlsHBqZDOvv-UnuUI7aD_4,14249
|
|
34
34
|
lamindb_setup/core/_settings_store.py,sha256=VEE8Ff2A7y4j8ksOaa7g48jNaOqe1PBnBjb1PKKGUKU,2115
|
|
35
35
|
lamindb_setup/core/_settings_user.py,sha256=P2lC4WDRAFfT-Xq3MlXJ-wMKIHCoGNhMTQfRGIAyUNQ,1344
|
|
36
36
|
lamindb_setup/core/_setup_bionty_sources.py,sha256=ANBIiWHoYxLBQqsiKs-rCq3k-p6D34T4NM28gkY6YLA,3389
|
|
@@ -40,7 +40,7 @@ lamindb_setup/core/exceptions.py,sha256=eoI7AXgATgDVzgArtN7CUvpaMUC067vsBg5LHCsW
|
|
|
40
40
|
lamindb_setup/core/hashing.py,sha256=Y2cvEaqtm3KwpHqj5ZG2f_sLaXhsQT4oDrmJdHbOQeo,3116
|
|
41
41
|
lamindb_setup/core/types.py,sha256=bcYnZ0uM_2NXKJCl94Mmc-uYrQlRUUVKG3sK2N-F-N4,532
|
|
42
42
|
lamindb_setup/core/upath.py,sha256=EPLLm62q-Y3hZzd-286cynFMttXKDNXNOKL3_QGkeug,27215
|
|
43
|
-
lamindb_setup-0.76.
|
|
44
|
-
lamindb_setup-0.76.
|
|
45
|
-
lamindb_setup-0.76.
|
|
46
|
-
lamindb_setup-0.76.
|
|
43
|
+
lamindb_setup-0.76.6.dist-info/LICENSE,sha256=UOZ1F5fFDe3XXvG4oNnkL1-Ecun7zpHzRxjp-XsMeAo,11324
|
|
44
|
+
lamindb_setup-0.76.6.dist-info/WHEEL,sha256=Sgu64hAMa6g5FdzHxXv9Xdse9yxpGGMeagVtPMWpJQY,99
|
|
45
|
+
lamindb_setup-0.76.6.dist-info/METADATA,sha256=aipPhnfIkB8MWkSmDkqbCSb-iOcQNbbs0lcQzqa5_w8,1638
|
|
46
|
+
lamindb_setup-0.76.6.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|