oceanprotocol-job-details 0.1.3__tar.gz → 0.1.4__tar.gz
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.
- {oceanprotocol_job_details-0.1.3 → oceanprotocol_job_details-0.1.4}/PKG-INFO +1 -1
- {oceanprotocol_job_details-0.1.3 → oceanprotocol_job_details-0.1.4}/oceanprotocol_job_details/config.py +11 -10
- {oceanprotocol_job_details-0.1.3 → oceanprotocol_job_details-0.1.4}/oceanprotocol_job_details/ocean.py +18 -1
- {oceanprotocol_job_details-0.1.3 → oceanprotocol_job_details-0.1.4}/pyproject.toml +1 -1
- {oceanprotocol_job_details-0.1.3 → oceanprotocol_job_details-0.1.4}/.gitignore +0 -0
- {oceanprotocol_job_details-0.1.3 → oceanprotocol_job_details-0.1.4}/LICENSE +0 -0
- {oceanprotocol_job_details-0.1.3 → oceanprotocol_job_details-0.1.4}/README.md +0 -0
- {oceanprotocol_job_details-0.1.3 → oceanprotocol_job_details-0.1.4}/oceanprotocol_job_details/__init__.py +0 -0
- {oceanprotocol_job_details-0.1.3 → oceanprotocol_job_details-0.1.4}/oceanprotocol_job_details/job_details.py +0 -0
- {oceanprotocol_job_details-0.1.3 → oceanprotocol_job_details-0.1.4}/oceanprotocol_job_details/loaders/__init__.py +0 -0
- {oceanprotocol_job_details-0.1.3 → oceanprotocol_job_details-0.1.4}/oceanprotocol_job_details/loaders/impl/__init__.py +0 -0
- {oceanprotocol_job_details-0.1.3 → oceanprotocol_job_details-0.1.4}/oceanprotocol_job_details/loaders/impl/ddo.py +0 -0
- {oceanprotocol_job_details-0.1.3 → oceanprotocol_job_details-0.1.4}/oceanprotocol_job_details/loaders/impl/files.py +0 -0
- {oceanprotocol_job_details-0.1.3 → oceanprotocol_job_details-0.1.4}/oceanprotocol_job_details/loaders/impl/job_details.py +0 -0
- {oceanprotocol_job_details-0.1.3 → oceanprotocol_job_details-0.1.4}/oceanprotocol_job_details/loaders/loader.py +0 -0
- {oceanprotocol_job_details-0.1.3 → oceanprotocol_job_details-0.1.4}/oceanprotocol_job_details/utils.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: oceanprotocol-job-details
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.4
|
|
4
4
|
Summary: A Python package to get details from OceanProtocol jobs
|
|
5
5
|
Project-URL: Homepage, https://github.com/AgrospAI/oceanprotocol-job-details
|
|
6
6
|
Project-URL: Issues, https://github.com/AgrospAI/oceanprotocol-job-details/issues
|
|
@@ -9,22 +9,22 @@ logger = getLogger(__name__)
|
|
|
9
9
|
class Config:
|
|
10
10
|
"""Configuration class for the Ocean Protocol Job Details"""
|
|
11
11
|
|
|
12
|
-
path_data:
|
|
12
|
+
path_data: Path = Path("/data")
|
|
13
13
|
"""The path to the data directory"""
|
|
14
14
|
|
|
15
|
-
path_inputs:
|
|
15
|
+
path_inputs: Path = path_data / "inputs"
|
|
16
16
|
"""The path to the inputs directory"""
|
|
17
17
|
|
|
18
|
-
path_ddos:
|
|
18
|
+
path_ddos: Path = path_data / "ddos"
|
|
19
19
|
"""The path to the DDOs directory"""
|
|
20
20
|
|
|
21
|
-
path_outputs:
|
|
21
|
+
path_outputs: Path = path_data / "outputs"
|
|
22
22
|
"""The path to the outputs directory"""
|
|
23
23
|
|
|
24
|
-
path_logs:
|
|
24
|
+
path_logs: Path = path_data / "logs"
|
|
25
25
|
"""The path to the logs directory"""
|
|
26
26
|
|
|
27
|
-
path_algorithm_custom_parameters:
|
|
27
|
+
path_algorithm_custom_parameters: Path = path_inputs / "algoCustomData.json"
|
|
28
28
|
"""The path to the algorithm's custom parameters file"""
|
|
29
29
|
|
|
30
30
|
|
|
@@ -43,11 +43,12 @@ def update_config_from(base: Path) -> None:
|
|
|
43
43
|
base.mkdir(parents=True, exist_ok=True)
|
|
44
44
|
|
|
45
45
|
for field in fields(config):
|
|
46
|
-
|
|
47
|
-
if
|
|
48
|
-
raise ValueError(f"Field {field.name}
|
|
46
|
+
current_value = getattr(config, field.name)
|
|
47
|
+
if not isinstance(current_value, Path):
|
|
48
|
+
raise ValueError(f"Field {field.name} is n|ot a Path")
|
|
49
49
|
|
|
50
|
-
|
|
50
|
+
rel_path = Path(current_value).relative_to("/data")
|
|
51
|
+
object.__setattr__(config, field.name, base / rel_path)
|
|
51
52
|
|
|
52
53
|
|
|
53
54
|
__all__ = ["config"]
|
|
@@ -2,6 +2,8 @@ from dataclasses import dataclass, field
|
|
|
2
2
|
from functools import cached_property
|
|
3
3
|
from typing import Any, Generic, Optional, Type, TypeVar, final
|
|
4
4
|
|
|
5
|
+
import orjson
|
|
6
|
+
|
|
5
7
|
from dataclasses_json import config as dc_config
|
|
6
8
|
from dataclasses_json import dataclass_json
|
|
7
9
|
|
|
@@ -155,6 +157,20 @@ class DDO:
|
|
|
155
157
|
purgatory: Purgatory
|
|
156
158
|
|
|
157
159
|
|
|
160
|
+
def _normalize_json(value):
|
|
161
|
+
if isinstance(value, str):
|
|
162
|
+
try:
|
|
163
|
+
decoded = orjson.loads(value)
|
|
164
|
+
return _normalize_json(decoded) # recurse if nested again
|
|
165
|
+
except orjson.JSONDecodeError:
|
|
166
|
+
return value
|
|
167
|
+
elif isinstance(value, dict):
|
|
168
|
+
return {k: _normalize_json(v) for k, v in value.items()}
|
|
169
|
+
elif isinstance(value, list):
|
|
170
|
+
return [_normalize_json(v) for v in value]
|
|
171
|
+
return value
|
|
172
|
+
|
|
173
|
+
|
|
158
174
|
@final
|
|
159
175
|
@dataclass_json
|
|
160
176
|
@dataclass(frozen=True)
|
|
@@ -186,7 +202,8 @@ class JobDetails(Generic[T]):
|
|
|
186
202
|
f"Custom parameters file {config.path_algorithm_custom_parameters} is empty"
|
|
187
203
|
)
|
|
188
204
|
try:
|
|
189
|
-
|
|
205
|
+
parsed = _normalize_json(orjson.loads(raw))
|
|
206
|
+
return dataclass_json(self._type).from_dict(parsed) # type: ignore
|
|
190
207
|
except Exception as e:
|
|
191
208
|
raise ValueError(
|
|
192
209
|
f"Failed to parse input paramers into {self._type.__name__}: {e}\n"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|