oceanprotocol-job-details 0.3.12__tar.gz → 0.3.13__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.3.12 → oceanprotocol_job_details-0.3.13}/PKG-INFO +4 -3
- {oceanprotocol_job_details-0.3.12 → oceanprotocol_job_details-0.3.13}/README.md +3 -2
- oceanprotocol_job_details-0.3.13/oceanprotocol_job_details/executors.py +25 -0
- {oceanprotocol_job_details-0.3.12 → oceanprotocol_job_details-0.3.13}/oceanprotocol_job_details/ocean.py +8 -4
- {oceanprotocol_job_details-0.3.12 → oceanprotocol_job_details-0.3.13}/pyproject.toml +9 -2
- oceanprotocol_job_details-0.3.12/oceanprotocol_job_details/executors.py +0 -24
- {oceanprotocol_job_details-0.3.12 → oceanprotocol_job_details-0.3.13}/.gitignore +0 -0
- {oceanprotocol_job_details-0.3.12 → oceanprotocol_job_details-0.3.13}/LICENSE +0 -0
- {oceanprotocol_job_details-0.3.12 → oceanprotocol_job_details-0.3.13}/oceanprotocol_job_details/__init__.py +0 -0
- {oceanprotocol_job_details-0.3.12 → oceanprotocol_job_details-0.3.13}/oceanprotocol_job_details/di.py +0 -0
- {oceanprotocol_job_details-0.3.12 → oceanprotocol_job_details-0.3.13}/oceanprotocol_job_details/domain.py +0 -0
- {oceanprotocol_job_details-0.3.12 → oceanprotocol_job_details-0.3.13}/oceanprotocol_job_details/helpers.py +0 -0
- {oceanprotocol_job_details-0.3.12 → oceanprotocol_job_details-0.3.13}/oceanprotocol_job_details/loaders/__init__.py +0 -0
- {oceanprotocol_job_details-0.3.12 → oceanprotocol_job_details-0.3.13}/oceanprotocol_job_details/loaders/impl/__init__.py +0 -0
- {oceanprotocol_job_details-0.3.12 → oceanprotocol_job_details-0.3.13}/oceanprotocol_job_details/loaders/impl/ddo.py +0 -0
- {oceanprotocol_job_details-0.3.12 → oceanprotocol_job_details-0.3.13}/oceanprotocol_job_details/loaders/impl/files.py +0 -0
- {oceanprotocol_job_details-0.3.12 → oceanprotocol_job_details-0.3.13}/oceanprotocol_job_details/loaders/impl/job_details.py +0 -0
- {oceanprotocol_job_details-0.3.12 → oceanprotocol_job_details-0.3.13}/oceanprotocol_job_details/loaders/loader.py +0 -0
- {oceanprotocol_job_details-0.3.12 → oceanprotocol_job_details-0.3.13}/oceanprotocol_job_details/py.typed +0 -0
- {oceanprotocol_job_details-0.3.12 → oceanprotocol_job_details-0.3.13}/oceanprotocol_job_details/settings.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: oceanprotocol-job-details
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.13
|
|
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
|
|
@@ -72,8 +72,9 @@ class InputParameters(BaseModel):
|
|
|
72
72
|
job_details = load_job_details({"base_dir": "...", "transformation_did": "..."}, InputParameters)
|
|
73
73
|
|
|
74
74
|
# Usage
|
|
75
|
-
job_details.input_parameters
|
|
76
|
-
|
|
75
|
+
parameters = await job_details.input_parameters()
|
|
76
|
+
parameters.foo
|
|
77
|
+
parameters.foo.bar
|
|
77
78
|
```
|
|
78
79
|
|
|
79
80
|
The values to fill the custom `InputParameters` will be parsed from the `algoCustomData.json` located next to the input data directories.
|
|
@@ -46,8 +46,9 @@ class InputParameters(BaseModel):
|
|
|
46
46
|
job_details = load_job_details({"base_dir": "...", "transformation_did": "..."}, InputParameters)
|
|
47
47
|
|
|
48
48
|
# Usage
|
|
49
|
-
job_details.input_parameters
|
|
50
|
-
|
|
49
|
+
parameters = await job_details.input_parameters()
|
|
50
|
+
parameters.foo
|
|
51
|
+
parameters.foo.bar
|
|
51
52
|
```
|
|
52
53
|
|
|
53
54
|
The values to fill the custom `InputParameters` will be parsed from the `algoCustomData.json` located next to the input data directories.
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import asyncio
|
|
2
|
+
import inspect
|
|
3
|
+
from typing import Any, Callable, Coroutine, TypeVar
|
|
4
|
+
|
|
5
|
+
T = TypeVar("T")
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
async def run_in_executor(
|
|
9
|
+
obj: Callable[..., T]
|
|
10
|
+
| Callable[..., Coroutine[Any, Any, T]]
|
|
11
|
+
| Coroutine[Any, Any, T],
|
|
12
|
+
*args,
|
|
13
|
+
**kwargs,
|
|
14
|
+
) -> T:
|
|
15
|
+
if inspect.iscoroutinefunction(obj):
|
|
16
|
+
return await obj(*args, **kwargs)
|
|
17
|
+
|
|
18
|
+
if inspect.iscoroutine(obj):
|
|
19
|
+
return await obj
|
|
20
|
+
|
|
21
|
+
if callable(obj):
|
|
22
|
+
loop = asyncio.get_running_loop()
|
|
23
|
+
return await loop.run_in_executor(None, obj, *args, **kwargs)
|
|
24
|
+
|
|
25
|
+
return obj
|
|
@@ -24,6 +24,8 @@ class JobDetails(BaseModel, Generic[InputParametersT]): # type: ignore[explicit
|
|
|
24
24
|
|
|
25
25
|
model_config = ConfigDict(arbitrary_types_allowed=True, frozen=True)
|
|
26
26
|
|
|
27
|
+
_input_parameters: InputParametersT | None = None
|
|
28
|
+
|
|
27
29
|
def inputs(self) -> Generator[Tuple[int, Path], None, None]:
|
|
28
30
|
yield from (
|
|
29
31
|
(idx, file)
|
|
@@ -31,11 +33,13 @@ class JobDetails(BaseModel, Generic[InputParametersT]): # type: ignore[explicit
|
|
|
31
33
|
for file in files.input_files
|
|
32
34
|
)
|
|
33
35
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
36
|
+
async def input_parameters(self) -> InputParametersT:
|
|
37
|
+
if self._input_parameters is None:
|
|
38
|
+
input_parameters = await self.ainput_parameters()
|
|
39
|
+
object.__setattr__(self, "_input_parameters", input_parameters)
|
|
40
|
+
return self._input_parameters
|
|
37
41
|
|
|
38
|
-
async def ainput_parameters(self) -> InputParametersT
|
|
42
|
+
async def ainput_parameters(self) -> InputParametersT:
|
|
39
43
|
if self.input_type is None:
|
|
40
44
|
return None
|
|
41
45
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "oceanprotocol-job-details"
|
|
3
|
-
version = "0.3.
|
|
3
|
+
version = "0.3.13"
|
|
4
4
|
description = "A Python package to get details from OceanProtocol jobs"
|
|
5
5
|
authors = [
|
|
6
6
|
{ name = "Agrospai", email = "agrospai@udl.cat" },
|
|
@@ -27,6 +27,8 @@ Homepage = "https://github.com/AgrospAI/oceanprotocol-job-details"
|
|
|
27
27
|
Issues = "https://github.com/AgrospAI/oceanprotocol-job-details/issues"
|
|
28
28
|
|
|
29
29
|
[tool.pytest.ini_options]
|
|
30
|
+
asyncio_mode = "auto"
|
|
31
|
+
asyncio_default_fixture_loop_scope = "function"
|
|
30
32
|
log_level = "INFO"
|
|
31
33
|
pythonpath = "oceanprotocol_job_details"
|
|
32
34
|
log_cli = true
|
|
@@ -51,4 +53,9 @@ warn_return_any = true
|
|
|
51
53
|
disallow_any_explicit = true
|
|
52
54
|
|
|
53
55
|
[dependency-groups]
|
|
54
|
-
dev = [
|
|
56
|
+
dev = [
|
|
57
|
+
"mypy>=1.15.0",
|
|
58
|
+
"pytest>=8.3.4",
|
|
59
|
+
"pytest-asyncio>=1.3.0",
|
|
60
|
+
"types-aiofiles>=25.1.0.20251011",
|
|
61
|
+
]
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import asyncio
|
|
2
|
-
import inspect
|
|
3
|
-
from typing import Any, Callable, Coroutine, TypeVar
|
|
4
|
-
|
|
5
|
-
T = TypeVar("T")
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
def run_in_executor(obj: Callable[..., Any] | Coroutine[Any, Any, T]) -> T:
|
|
9
|
-
if callable(obj) and not inspect.iscoroutinefunction(obj):
|
|
10
|
-
return obj()
|
|
11
|
-
|
|
12
|
-
if inspect.iscoroutinefunction(obj):
|
|
13
|
-
obj = obj()
|
|
14
|
-
|
|
15
|
-
if not inspect.iscoroutine(obj):
|
|
16
|
-
return obj
|
|
17
|
-
|
|
18
|
-
try:
|
|
19
|
-
loop = asyncio.get_running_loop()
|
|
20
|
-
except RuntimeError:
|
|
21
|
-
return asyncio.run(obj)
|
|
22
|
-
|
|
23
|
-
future = asyncio.run_coroutine_threadsafe(obj, loop)
|
|
24
|
-
return future.result()
|
|
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
|
|
File without changes
|
|
File without changes
|