anemoi-utils 0.4.6__py3-none-any.whl → 0.4.8__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.
Potentially problematic release.
This version of anemoi-utils might be problematic. Click here for more details.
- anemoi/utils/_version.py +2 -2
- anemoi/utils/config.py +1 -1
- anemoi/utils/remote/__init__.py +4 -2
- anemoi/utils/remote/s3.py +3 -0
- anemoi/utils/remote/ssh.py +6 -2
- {anemoi_utils-0.4.6.dist-info → anemoi_utils-0.4.8.dist-info}/METADATA +1 -1
- {anemoi_utils-0.4.6.dist-info → anemoi_utils-0.4.8.dist-info}/RECORD +11 -11
- {anemoi_utils-0.4.6.dist-info → anemoi_utils-0.4.8.dist-info}/LICENSE +0 -0
- {anemoi_utils-0.4.6.dist-info → anemoi_utils-0.4.8.dist-info}/WHEEL +0 -0
- {anemoi_utils-0.4.6.dist-info → anemoi_utils-0.4.8.dist-info}/entry_points.txt +0 -0
- {anemoi_utils-0.4.6.dist-info → anemoi_utils-0.4.8.dist-info}/top_level.txt +0 -0
anemoi/utils/_version.py
CHANGED
anemoi/utils/config.py
CHANGED
|
@@ -207,7 +207,7 @@ def load_any_dict_format(path) -> dict:
|
|
|
207
207
|
return tomllib.load(f)
|
|
208
208
|
except (json.JSONDecodeError, yaml.YAMLError, tomllib.TOMLDecodeError) as e:
|
|
209
209
|
LOG.warning(f"Failed to parse config file {path}", exc_info=e)
|
|
210
|
-
|
|
210
|
+
raise ValueError(f"Failed to parse config file {path} [{e}]")
|
|
211
211
|
|
|
212
212
|
return open(path).read()
|
|
213
213
|
|
anemoi/utils/remote/__init__.py
CHANGED
|
@@ -138,6 +138,8 @@ class BaseDownload(Loader):
|
|
|
138
138
|
raise NotImplementedError
|
|
139
139
|
|
|
140
140
|
def get_temporary_target(self, target, pattern):
|
|
141
|
+
if pattern is None:
|
|
142
|
+
return target
|
|
141
143
|
dirname, basename = os.path.split(target)
|
|
142
144
|
return pattern.format(dirname=dirname, basename=basename)
|
|
143
145
|
|
|
@@ -199,13 +201,13 @@ class Transfer:
|
|
|
199
201
|
target = os.path.basename(source)
|
|
200
202
|
|
|
201
203
|
temporary_target = {
|
|
202
|
-
False:
|
|
204
|
+
False: None,
|
|
203
205
|
True: "{dirname}-downloading/{basename}",
|
|
204
206
|
"-tmp/*": "{dirname}-tmp/{basename}",
|
|
205
207
|
"*-tmp": "{dirname}/{basename}-tmp",
|
|
206
208
|
"tmp-*": "{dirname}/tmp-{basename}",
|
|
207
209
|
}.get(temporary_target, temporary_target)
|
|
208
|
-
assert isinstance(temporary_target, str), (type(temporary_target), temporary_target)
|
|
210
|
+
assert temporary_target is None or isinstance(temporary_target, str), (type(temporary_target), temporary_target)
|
|
209
211
|
|
|
210
212
|
self.source = source
|
|
211
213
|
self.target = target
|
anemoi/utils/remote/s3.py
CHANGED
|
@@ -192,6 +192,9 @@ class S3Download(BaseDownload):
|
|
|
192
192
|
_, _, bucket, key = source.split("/", 3)
|
|
193
193
|
s3 = s3_client(bucket)
|
|
194
194
|
|
|
195
|
+
if key.endswith("/"):
|
|
196
|
+
return 0
|
|
197
|
+
|
|
195
198
|
try:
|
|
196
199
|
response = s3.head_object(Bucket=bucket, Key=key)
|
|
197
200
|
except s3.exceptions.ClientError as e:
|
anemoi/utils/remote/ssh.py
CHANGED
|
@@ -44,12 +44,16 @@ class SshBaseUpload(BaseUpload):
|
|
|
44
44
|
hostnames = hostname.split("+")
|
|
45
45
|
hostname = hostnames[random.randint(0, len(hostnames) - 1)]
|
|
46
46
|
|
|
47
|
+
if ".." in path.split("/"):
|
|
48
|
+
raise Exception("Path contains suspicious '..' : {target}")
|
|
49
|
+
|
|
47
50
|
return hostname, path
|
|
48
51
|
|
|
49
52
|
def get_temporary_target(self, target, pattern):
|
|
50
53
|
hostname, path = self._parse_target(target)
|
|
51
|
-
|
|
52
|
-
|
|
54
|
+
if pattern is not None:
|
|
55
|
+
dirname, basename = os.path.split(path)
|
|
56
|
+
path = pattern.format(dirname=dirname, basename=basename)
|
|
53
57
|
return f"ssh://{hostname}:{path}"
|
|
54
58
|
|
|
55
59
|
def rename_target(self, target, new_target):
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: anemoi-utils
|
|
3
|
-
Version: 0.4.
|
|
3
|
+
Version: 0.4.8
|
|
4
4
|
Summary: A package to hold various functions to support training of ML models on ECMWF data.
|
|
5
5
|
Author-email: "European Centre for Medium-Range Weather Forecasts (ECMWF)" <software.support@ecmwf.int>
|
|
6
6
|
License: Apache License
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
anemoi/utils/__init__.py,sha256=0u0eIdu5-H1frf6V4KHpNmlh_SS-bJnxjzIejlsLqdw,702
|
|
2
2
|
anemoi/utils/__main__.py,sha256=5NW2A3OgTimB4ptwYThivIRSeCrvabMuvnr8mmnVx0E,715
|
|
3
|
-
anemoi/utils/_version.py,sha256=
|
|
3
|
+
anemoi/utils/_version.py,sha256=WKH2DAU2byiQfZy9XW8vTna5aTSXgkj8aA__Cy4DLwQ,411
|
|
4
4
|
anemoi/utils/caching.py,sha256=0cznpvaaox14NSVi-Q3PqumfuGtXo0YNcEFwDPxvMZw,1948
|
|
5
5
|
anemoi/utils/checkpoints.py,sha256=q8QqKlZ6qChjzEfq7KM1gVXuyqgsVRGIb4dJFtkGk58,7774
|
|
6
6
|
anemoi/utils/cli.py,sha256=rmMP60VY3em99rQP6TCrKibMngWwVe5h_0GDcf16c5U,4117
|
|
7
7
|
anemoi/utils/compatibility.py,sha256=0_nIcbdQbNMrS6AkqrBgJGJlSJXW8R23ncaZaDwdJ4c,2190
|
|
8
|
-
anemoi/utils/config.py,sha256=
|
|
8
|
+
anemoi/utils/config.py,sha256=At0k_NtbJ74S72sEZIYgdEaLf5KCEvxIJi9FGLcUwrE,9872
|
|
9
9
|
anemoi/utils/dates.py,sha256=wwYD5_QI7EWY_jhpENNYtL5O7fjwYkzmqHkNoayvmrY,12452
|
|
10
10
|
anemoi/utils/grib.py,sha256=zBICyOsYtR_9px1C5UDT6wL_D6kiIhUi_00kjFmas5c,3047
|
|
11
11
|
anemoi/utils/hindcasts.py,sha256=TEYDmrZUajuhp_dfWeg6z5c6XfntE-mwugUQJyAgUco,1419
|
|
@@ -21,12 +21,12 @@ anemoi/utils/commands/__init__.py,sha256=O5W3yHZywRoAqmRUioAr3zMCh0hGVV18wZYGvc0
|
|
|
21
21
|
anemoi/utils/commands/config.py,sha256=zt4PFATYJ-zs0C5mpUlrQ4Fj5m1kM3CcsszUP1VBbzA,816
|
|
22
22
|
anemoi/utils/mars/__init__.py,sha256=kvbu-gSaYI9jSNEzfQltrtHPVIameYGoLjOJKwI7x_U,1723
|
|
23
23
|
anemoi/utils/mars/mars.yaml,sha256=R0dujp75lLA4wCWhPeOQnzJ45WZAYLT8gpx509cBFlc,66
|
|
24
|
-
anemoi/utils/remote/__init__.py,sha256=
|
|
25
|
-
anemoi/utils/remote/s3.py,sha256=
|
|
26
|
-
anemoi/utils/remote/ssh.py,sha256=
|
|
27
|
-
anemoi_utils-0.4.
|
|
28
|
-
anemoi_utils-0.4.
|
|
29
|
-
anemoi_utils-0.4.
|
|
30
|
-
anemoi_utils-0.4.
|
|
31
|
-
anemoi_utils-0.4.
|
|
32
|
-
anemoi_utils-0.4.
|
|
24
|
+
anemoi/utils/remote/__init__.py,sha256=f6pfM0PiCabyRmqDFOsXegnXbOvkaUiHGeC9ThU9Ero,11545
|
|
25
|
+
anemoi/utils/remote/s3.py,sha256=hykbVlh1_aFI00FWjgm_FWIMfVCTFiQf_cq8_gAo31s,11976
|
|
26
|
+
anemoi/utils/remote/ssh.py,sha256=3lqFpY9CEor_DvIK9ZxSmj3rND-366Sm9R3Vw61sWSs,4695
|
|
27
|
+
anemoi_utils-0.4.8.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
|
28
|
+
anemoi_utils-0.4.8.dist-info/METADATA,sha256=mfdZdTOTRN6Ata0zc4V7UkIKgKImSXI3IO1JumHWwss,15222
|
|
29
|
+
anemoi_utils-0.4.8.dist-info/WHEEL,sha256=R06PA3UVYHThwHvxuRWMqaGcr-PuniXahwjmQRFMEkY,91
|
|
30
|
+
anemoi_utils-0.4.8.dist-info/entry_points.txt,sha256=LENOkn88xzFQo-V59AKoA_F_cfYQTJYtrNTtf37YgHY,60
|
|
31
|
+
anemoi_utils-0.4.8.dist-info/top_level.txt,sha256=DYn8VPs-fNwr7fNH9XIBqeXIwiYYd2E2k5-dUFFqUz0,7
|
|
32
|
+
anemoi_utils-0.4.8.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|