lamindb_setup 0.72.0__py2.py3-none-any.whl → 0.72.2__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/core/_aws_credentials.py +15 -4
- lamindb_setup/core/_hub_core.py +0 -2
- lamindb_setup/core/_settings_instance.py +9 -1
- {lamindb_setup-0.72.0.dist-info → lamindb_setup-0.72.2.dist-info}/METADATA +1 -1
- {lamindb_setup-0.72.0.dist-info → lamindb_setup-0.72.2.dist-info}/RECORD +8 -8
- {lamindb_setup-0.72.0.dist-info → lamindb_setup-0.72.2.dist-info}/LICENSE +0 -0
- {lamindb_setup-0.72.0.dist-info → lamindb_setup-0.72.2.dist-info}/WHEEL +0 -0
lamindb_setup/__init__.py
CHANGED
|
@@ -22,6 +22,10 @@ else:
|
|
|
22
22
|
HOSTED_BUCKETS = ("s3://lamin-hosted-test",) # type: ignore
|
|
23
23
|
|
|
24
24
|
|
|
25
|
+
def _keep_trailing_slash(path_str: str):
|
|
26
|
+
return path_str if path_str[-1] == "/" else path_str + "/"
|
|
27
|
+
|
|
28
|
+
|
|
25
29
|
AWS_CREDENTIALS_EXPIRATION = 11 * 60 * 60 # refresh credentials after 11 hours
|
|
26
30
|
|
|
27
31
|
|
|
@@ -81,7 +85,10 @@ class AWSCredentialsManager:
|
|
|
81
85
|
return S3Path(path, cache_regions=cache_regions, **connection_options)
|
|
82
86
|
|
|
83
87
|
def enrich_path(self, path: S3Path, access_token: str | None = None) -> S3Path:
|
|
84
|
-
|
|
88
|
+
# trailing slash is needed to avoid returning incorrect results
|
|
89
|
+
# with .startswith
|
|
90
|
+
# for example s3://lamindata-eu should not receive cache for s3://lamindata
|
|
91
|
+
path_str = _keep_trailing_slash(path.as_posix())
|
|
85
92
|
root = self._find_root(path_str)
|
|
86
93
|
|
|
87
94
|
if root is not None:
|
|
@@ -99,10 +106,14 @@ class AWSCredentialsManager:
|
|
|
99
106
|
|
|
100
107
|
if set_cache:
|
|
101
108
|
from ._hub_core import access_aws
|
|
109
|
+
from ._settings import settings
|
|
102
110
|
|
|
103
|
-
|
|
104
|
-
|
|
111
|
+
if settings.user.handle != "anonymous" or access_token is not None:
|
|
112
|
+
storage_root_info = access_aws(path_str, access_token=access_token)
|
|
113
|
+
else:
|
|
114
|
+
storage_root_info = {"credentials": {}, "accessibility": {}}
|
|
105
115
|
|
|
116
|
+
accessibility = storage_root_info["accessibility"]
|
|
106
117
|
is_managed = accessibility.get("is_managed", False)
|
|
107
118
|
if is_managed:
|
|
108
119
|
credentials = storage_root_info["credentials"]
|
|
@@ -123,7 +134,7 @@ class AWSCredentialsManager:
|
|
|
123
134
|
# write the bucket for everything else
|
|
124
135
|
root = path._url.netloc
|
|
125
136
|
root = "s3://" + root
|
|
126
|
-
self._set_cached_credentials(root, credentials)
|
|
137
|
+
self._set_cached_credentials(_keep_trailing_slash(root), credentials)
|
|
127
138
|
|
|
128
139
|
return self._path_inject_options(path, credentials)
|
|
129
140
|
|
lamindb_setup/core/_hub_core.py
CHANGED
|
@@ -387,8 +387,6 @@ def _access_aws(*, storage_root: str, client: Client) -> dict[str, dict]:
|
|
|
387
387
|
accessibility = storage_root_info["accessibility"]
|
|
388
388
|
accessibility["storage_root"] = loaded_accessibility["storageRoot"]
|
|
389
389
|
accessibility["is_managed"] = loaded_accessibility["isManaged"]
|
|
390
|
-
elif lamindb_setup._TESTING:
|
|
391
|
-
raise RuntimeError(f"access-aws errored: {response}")
|
|
392
390
|
return storage_root_info
|
|
393
391
|
|
|
394
392
|
|
|
@@ -5,6 +5,7 @@ import shutil
|
|
|
5
5
|
from pathlib import Path
|
|
6
6
|
from typing import TYPE_CHECKING, Literal
|
|
7
7
|
|
|
8
|
+
from django.db.utils import ProgrammingError
|
|
8
9
|
from lamin_utils import logger
|
|
9
10
|
|
|
10
11
|
from ._hub_client import call_with_fallback
|
|
@@ -106,8 +107,15 @@ class InstanceSettings:
|
|
|
106
107
|
local_records = Storage.objects.filter(root=local_root)
|
|
107
108
|
else:
|
|
108
109
|
local_records = Storage.objects.filter(type="local")
|
|
110
|
+
all_local_records = local_records.all()
|
|
111
|
+
try:
|
|
112
|
+
# trigger an error in case of a migration issue
|
|
113
|
+
all_local_records.first()
|
|
114
|
+
except ProgrammingError:
|
|
115
|
+
logger.error("not able to load Storage registry: please migrate")
|
|
116
|
+
return None
|
|
109
117
|
found = False
|
|
110
|
-
for record in
|
|
118
|
+
for record in all_local_records:
|
|
111
119
|
root_path = Path(record.root)
|
|
112
120
|
if root_path.exists():
|
|
113
121
|
marker_path = root_path / ".lamindb/_is_initialized"
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
lamindb_setup/__init__.py,sha256=
|
|
1
|
+
lamindb_setup/__init__.py,sha256=p_LDSrN8hygUj_CeoWH3ZILNhJi_GQVghFfu7pSmt5w,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
|
|
@@ -16,16 +16,16 @@ lamindb_setup/_set_managed_storage.py,sha256=mNZrANn-9rwZ0oGWxxg0wS0T0VOQCWyo4nS
|
|
|
16
16
|
lamindb_setup/_setup_user.py,sha256=6Oc7Rke-yRQSZbuntdUAz8QbJ6UuPzYHI9FnYlf_q-A,3670
|
|
17
17
|
lamindb_setup/_silence_loggers.py,sha256=AKF_YcHvX32eGXdsYK8MJlxEaZ-Uo2f6QDRzjKFCtws,1568
|
|
18
18
|
lamindb_setup/core/__init__.py,sha256=dV9S-rQpNK9JcBn4hiEmiLnmNqfpPFJD9pqagMCaIew,416
|
|
19
|
-
lamindb_setup/core/_aws_credentials.py,sha256=
|
|
19
|
+
lamindb_setup/core/_aws_credentials.py,sha256=nK04-lNYz6MYDgD6Z56peoxCULZ82uFDRMzjwsPh25U,5293
|
|
20
20
|
lamindb_setup/core/_aws_storage.py,sha256=nEjeUv4xUVpoV0Lx-zjjmyb9w804bDyaeiM-OqbfwM0,1799
|
|
21
21
|
lamindb_setup/core/_deprecated.py,sha256=3qxUI1dnDlSeR0BYrv7ucjqRBEojbqotPgpShXs4KF8,2520
|
|
22
22
|
lamindb_setup/core/_docs.py,sha256=3k-YY-oVaJd_9UIY-LfBg_u8raKOCNfkZQPA73KsUhs,276
|
|
23
23
|
lamindb_setup/core/_hub_client.py,sha256=V0qKDsCdRn-tQy2YIk4VgXcpJFmuum6N3gcavAC7gBQ,5504
|
|
24
|
-
lamindb_setup/core/_hub_core.py,sha256=
|
|
24
|
+
lamindb_setup/core/_hub_core.py,sha256=RGjTqf1owuWmkXAYy0EPaoHAaJ-0T0hAidkqa3cIdiM,16352
|
|
25
25
|
lamindb_setup/core/_hub_crud.py,sha256=b1XF7AJpM9Q-ttm9nPG-r3OTRWHQaGzAGIyvmb83NTo,4859
|
|
26
26
|
lamindb_setup/core/_hub_utils.py,sha256=b_M1LkdCjiMWm1EOlSb9GuPdLijwVgQDtATTpeZuXI0,1875
|
|
27
27
|
lamindb_setup/core/_settings.py,sha256=jjZ_AxRXB3Y3UP6m04BAw_dhFbJbdg2-nZWmEv2LNZ8,3141
|
|
28
|
-
lamindb_setup/core/_settings_instance.py,sha256=
|
|
28
|
+
lamindb_setup/core/_settings_instance.py,sha256=kda3kqUtwh-XZMDmbdFIp8RGGFw0Az8T8g2SKEU65mo,16949
|
|
29
29
|
lamindb_setup/core/_settings_load.py,sha256=NGgCDpN85j1EqoKlrYFIlZBMlBJm33gx2-wc96CP_ZQ,3922
|
|
30
30
|
lamindb_setup/core/_settings_save.py,sha256=d1A-Ex-7H08mb8l7I0Oe0j0GilrfaDuprh_NMxhQAsQ,2704
|
|
31
31
|
lamindb_setup/core/_settings_storage.py,sha256=7f0jt1zcSltpOYDPQ5CVvbBon_d7aneKTte935-2REY,13236
|
|
@@ -38,7 +38,7 @@ lamindb_setup/core/exceptions.py,sha256=eoI7AXgATgDVzgArtN7CUvpaMUC067vsBg5LHCsW
|
|
|
38
38
|
lamindb_setup/core/hashing.py,sha256=7r96h5JBzuwfOR_gNNqTyWNPKMuiOUfBYwn6sCbZkf8,2269
|
|
39
39
|
lamindb_setup/core/types.py,sha256=bcYnZ0uM_2NXKJCl94Mmc-uYrQlRUUVKG3sK2N-F-N4,532
|
|
40
40
|
lamindb_setup/core/upath.py,sha256=QnAiaOZgT1TLUaX0PEs9dSJ0E4ZDD431hCfKrJIbmqQ,26339
|
|
41
|
-
lamindb_setup-0.72.
|
|
42
|
-
lamindb_setup-0.72.
|
|
43
|
-
lamindb_setup-0.72.
|
|
44
|
-
lamindb_setup-0.72.
|
|
41
|
+
lamindb_setup-0.72.2.dist-info/LICENSE,sha256=UOZ1F5fFDe3XXvG4oNnkL1-Ecun7zpHzRxjp-XsMeAo,11324
|
|
42
|
+
lamindb_setup-0.72.2.dist-info/WHEEL,sha256=Sgu64hAMa6g5FdzHxXv9Xdse9yxpGGMeagVtPMWpJQY,99
|
|
43
|
+
lamindb_setup-0.72.2.dist-info/METADATA,sha256=oeLIvcLxoZcHsOT7yDplKrq89sW5elwq2TV9CpZWY6M,1620
|
|
44
|
+
lamindb_setup-0.72.2.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|