oceanprotocol-job-details 0.2.5__tar.gz → 0.2.6__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.2.6/PKG-INFO +125 -0
- oceanprotocol_job_details-0.2.6/README.md +101 -0
- {oceanprotocol_job_details-0.2.5 → oceanprotocol_job_details-0.2.6}/pyproject.toml +2 -1
- oceanprotocol_job_details-0.2.5/PKG-INFO +0 -76
- oceanprotocol_job_details-0.2.5/README.md +0 -52
- {oceanprotocol_job_details-0.2.5 → oceanprotocol_job_details-0.2.6}/.gitignore +0 -0
- {oceanprotocol_job_details-0.2.5 → oceanprotocol_job_details-0.2.6}/LICENSE +0 -0
- {oceanprotocol_job_details-0.2.5 → oceanprotocol_job_details-0.2.6}/oceanprotocol_job_details/__init__.py +0 -0
- {oceanprotocol_job_details-0.2.5 → oceanprotocol_job_details-0.2.6}/oceanprotocol_job_details/di.py +0 -0
- {oceanprotocol_job_details-0.2.5 → oceanprotocol_job_details-0.2.6}/oceanprotocol_job_details/loaders/__init__.py +0 -0
- {oceanprotocol_job_details-0.2.5 → oceanprotocol_job_details-0.2.6}/oceanprotocol_job_details/loaders/impl/__init__.py +0 -0
- {oceanprotocol_job_details-0.2.5 → oceanprotocol_job_details-0.2.6}/oceanprotocol_job_details/loaders/impl/ddo.py +0 -0
- {oceanprotocol_job_details-0.2.5 → oceanprotocol_job_details-0.2.6}/oceanprotocol_job_details/loaders/impl/files.py +0 -0
- {oceanprotocol_job_details-0.2.5 → oceanprotocol_job_details-0.2.6}/oceanprotocol_job_details/loaders/impl/job_details.py +0 -0
- {oceanprotocol_job_details-0.2.5 → oceanprotocol_job_details-0.2.6}/oceanprotocol_job_details/loaders/loader.py +0 -0
- {oceanprotocol_job_details-0.2.5 → oceanprotocol_job_details-0.2.6}/oceanprotocol_job_details/ocean.py +0 -0
- {oceanprotocol_job_details-0.2.5 → oceanprotocol_job_details-0.2.6}/oceanprotocol_job_details/paths.py +0 -0
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: oceanprotocol-job-details
|
|
3
|
+
Version: 0.2.6
|
|
4
|
+
Summary: A Python package to get details from OceanProtocol jobs
|
|
5
|
+
Project-URL: Homepage, https://github.com/AgrospAI/oceanprotocol-job-details
|
|
6
|
+
Project-URL: Issues, https://github.com/AgrospAI/oceanprotocol-job-details/issues
|
|
7
|
+
Author-email: Agrospai <agrospai@udl.cat>, Christian López García <christian.lopez@udl.cat>
|
|
8
|
+
License: Copyright 2025 Agrospai
|
|
9
|
+
|
|
10
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
13
|
+
|
|
14
|
+
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
15
|
+
License-File: LICENSE
|
|
16
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
17
|
+
Classifier: Operating System :: OS Independent
|
|
18
|
+
Classifier: Programming Language :: Python :: 3
|
|
19
|
+
Requires-Python: >=3.10
|
|
20
|
+
Requires-Dist: dataclasses-json>=0.6.7
|
|
21
|
+
Requires-Dist: dependency-injector>=4.48.2
|
|
22
|
+
Requires-Dist: orjson>=3.11.3
|
|
23
|
+
Description-Content-Type: text/markdown
|
|
24
|
+
|
|
25
|
+
A Python package to get details from OceanProtocol jobs
|
|
26
|
+
|
|
27
|
+
---
|
|
28
|
+
|
|
29
|
+
## Installation
|
|
30
|
+
|
|
31
|
+
```
|
|
32
|
+
pip install oceanprotocol-job-details
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Usage
|
|
36
|
+
|
|
37
|
+
As a simple library, we only need to import `JobDetails` and load it, it will:
|
|
38
|
+
|
|
39
|
+
1. Fetch the needed parameters to populate the `JobDetails` instance from the environment variables or use the passed values to the `load()` method.
|
|
40
|
+
1. Look for the files corresponding to the passed DIDs in the filesystem according to the [Ocean Protocol Structure](#oceanprotocol-structure) and load them into the `JobDetails` instance.
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
### Minimal Example
|
|
44
|
+
|
|
45
|
+
```python
|
|
46
|
+
from oceanprotocol_job_details import JobDetails
|
|
47
|
+
|
|
48
|
+
job_details = JobDetails.load()
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
### Custom Input Parameters
|
|
52
|
+
|
|
53
|
+
If our algorithm has custom input parameters and we want to load them into our algorithm, we can do it as follows:
|
|
54
|
+
|
|
55
|
+
```python
|
|
56
|
+
from dataclasses import dataclass
|
|
57
|
+
from oceanprotocol_job_details import JobDetails
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
@dataclass
|
|
61
|
+
class InputParameters:
|
|
62
|
+
foobar: str
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
job_details = JobDetails[InputParameters].load(InputParameters)
|
|
66
|
+
|
|
67
|
+
# Usage
|
|
68
|
+
job_details.input_parameters.foobar
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
```python
|
|
72
|
+
from dataclasses import dataclass
|
|
73
|
+
from oceanprotocol_job_details import JobDetails
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
@dataclass
|
|
77
|
+
class Foo:
|
|
78
|
+
bar: str
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
@dataclass
|
|
82
|
+
class InputParameters:
|
|
83
|
+
# Allows for nested types
|
|
84
|
+
foo: Foo
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
job_details = JobDetails[InputParameters].load(InputParameters)
|
|
88
|
+
|
|
89
|
+
# Usage
|
|
90
|
+
job_details.input_parameters.foo.bar
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
The values to fill the custom `InputParameters` will be parsed from the `algoCustomData.json` located next to the input data directories.
|
|
94
|
+
|
|
95
|
+
### Iterating Input Files the clean way
|
|
96
|
+
|
|
97
|
+
```python
|
|
98
|
+
from oceanprotocol_job_details import JobDetails
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
job_details = JobDetails.load()
|
|
102
|
+
|
|
103
|
+
for idx, file_path in job_details.next_file():
|
|
104
|
+
...
|
|
105
|
+
|
|
106
|
+
# Or if you just want one file path
|
|
107
|
+
_, file_path = job_details.next_file()
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
## OceanProtocol Structure
|
|
111
|
+
|
|
112
|
+
```bash
|
|
113
|
+
data # Root /data directory
|
|
114
|
+
├── ddos # Contains the loaded dataset's DDO
|
|
115
|
+
│ ├── 17feb...e42 # DDO file
|
|
116
|
+
│ └── ... # One DDO per loaded dataset
|
|
117
|
+
├── inputs # Datasets dir
|
|
118
|
+
│ ├── 17feb...e42 # Dir holding the data of its name DID, contains files named 0..X
|
|
119
|
+
│ │ └── 0 # Data file
|
|
120
|
+
│ └── algoCustomData.json # Custom algorithm input data
|
|
121
|
+
├── logs # Algorithm output logs dir
|
|
122
|
+
└── outputs # Algorithm output files dir
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
> **_Note:_** Even though it's possible that the algorithm is passed multiple datasets, right now the implementation only allows to use **one dataset** per algorithm execution, so **normally** the executing job will only have **one ddo**, **one dir** inside inputs, and **one data file** named `0`.
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
A Python package to get details from OceanProtocol jobs
|
|
2
|
+
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
pip install oceanprotocol-job-details
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
As a simple library, we only need to import `JobDetails` and load it, it will:
|
|
14
|
+
|
|
15
|
+
1. Fetch the needed parameters to populate the `JobDetails` instance from the environment variables or use the passed values to the `load()` method.
|
|
16
|
+
1. Look for the files corresponding to the passed DIDs in the filesystem according to the [Ocean Protocol Structure](#oceanprotocol-structure) and load them into the `JobDetails` instance.
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
### Minimal Example
|
|
20
|
+
|
|
21
|
+
```python
|
|
22
|
+
from oceanprotocol_job_details import JobDetails
|
|
23
|
+
|
|
24
|
+
job_details = JobDetails.load()
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
### Custom Input Parameters
|
|
28
|
+
|
|
29
|
+
If our algorithm has custom input parameters and we want to load them into our algorithm, we can do it as follows:
|
|
30
|
+
|
|
31
|
+
```python
|
|
32
|
+
from dataclasses import dataclass
|
|
33
|
+
from oceanprotocol_job_details import JobDetails
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
@dataclass
|
|
37
|
+
class InputParameters:
|
|
38
|
+
foobar: str
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
job_details = JobDetails[InputParameters].load(InputParameters)
|
|
42
|
+
|
|
43
|
+
# Usage
|
|
44
|
+
job_details.input_parameters.foobar
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
```python
|
|
48
|
+
from dataclasses import dataclass
|
|
49
|
+
from oceanprotocol_job_details import JobDetails
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
@dataclass
|
|
53
|
+
class Foo:
|
|
54
|
+
bar: str
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
@dataclass
|
|
58
|
+
class InputParameters:
|
|
59
|
+
# Allows for nested types
|
|
60
|
+
foo: Foo
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
job_details = JobDetails[InputParameters].load(InputParameters)
|
|
64
|
+
|
|
65
|
+
# Usage
|
|
66
|
+
job_details.input_parameters.foo.bar
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
The values to fill the custom `InputParameters` will be parsed from the `algoCustomData.json` located next to the input data directories.
|
|
70
|
+
|
|
71
|
+
### Iterating Input Files the clean way
|
|
72
|
+
|
|
73
|
+
```python
|
|
74
|
+
from oceanprotocol_job_details import JobDetails
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
job_details = JobDetails.load()
|
|
78
|
+
|
|
79
|
+
for idx, file_path in job_details.next_file():
|
|
80
|
+
...
|
|
81
|
+
|
|
82
|
+
# Or if you just want one file path
|
|
83
|
+
_, file_path = job_details.next_file()
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
## OceanProtocol Structure
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
data # Root /data directory
|
|
90
|
+
├── ddos # Contains the loaded dataset's DDO
|
|
91
|
+
│ ├── 17feb...e42 # DDO file
|
|
92
|
+
│ └── ... # One DDO per loaded dataset
|
|
93
|
+
├── inputs # Datasets dir
|
|
94
|
+
│ ├── 17feb...e42 # Dir holding the data of its name DID, contains files named 0..X
|
|
95
|
+
│ │ └── 0 # Data file
|
|
96
|
+
│ └── algoCustomData.json # Custom algorithm input data
|
|
97
|
+
├── logs # Algorithm output logs dir
|
|
98
|
+
└── outputs # Algorithm output files dir
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
> **_Note:_** Even though it's possible that the algorithm is passed multiple datasets, right now the implementation only allows to use **one dataset** per algorithm execution, so **normally** the executing job will only have **one ddo**, **one dir** inside inputs, and **one data file** named `0`.
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "oceanprotocol-job-details"
|
|
3
|
-
version = "0.2.
|
|
3
|
+
version = "0.2.6"
|
|
4
4
|
description = "A Python package to get details from OceanProtocol jobs"
|
|
5
5
|
authors = [
|
|
6
|
+
{ name = "Agrospai", email = "agrospai@udl.cat" },
|
|
6
7
|
{ name = "Christian López García", email = "christian.lopez@udl.cat" },
|
|
7
8
|
]
|
|
8
9
|
requires-python = ">=3.10"
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.4
|
|
2
|
-
Name: oceanprotocol-job-details
|
|
3
|
-
Version: 0.2.5
|
|
4
|
-
Summary: A Python package to get details from OceanProtocol jobs
|
|
5
|
-
Project-URL: Homepage, https://github.com/AgrospAI/oceanprotocol-job-details
|
|
6
|
-
Project-URL: Issues, https://github.com/AgrospAI/oceanprotocol-job-details/issues
|
|
7
|
-
Author-email: Christian López García <christian.lopez@udl.cat>
|
|
8
|
-
License: Copyright 2025 Agrospai
|
|
9
|
-
|
|
10
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
13
|
-
|
|
14
|
-
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
15
|
-
License-File: LICENSE
|
|
16
|
-
Classifier: License :: OSI Approved :: MIT License
|
|
17
|
-
Classifier: Operating System :: OS Independent
|
|
18
|
-
Classifier: Programming Language :: Python :: 3
|
|
19
|
-
Requires-Python: >=3.10
|
|
20
|
-
Requires-Dist: dataclasses-json>=0.6.7
|
|
21
|
-
Requires-Dist: dependency-injector>=4.48.2
|
|
22
|
-
Requires-Dist: orjson>=3.11.3
|
|
23
|
-
Description-Content-Type: text/markdown
|
|
24
|
-
|
|
25
|
-
A Python package to get details from OceanProtocol jobs
|
|
26
|
-
|
|
27
|
-
---
|
|
28
|
-
|
|
29
|
-
## Installation
|
|
30
|
-
|
|
31
|
-
```
|
|
32
|
-
pip install oceanprotocol-job-details
|
|
33
|
-
```
|
|
34
|
-
|
|
35
|
-
## Usage
|
|
36
|
-
|
|
37
|
-
As a simple library, we only need to import the main object and use it once:
|
|
38
|
-
|
|
39
|
-
```Python
|
|
40
|
-
from oceanprotocol_job_details import JobDetails
|
|
41
|
-
|
|
42
|
-
# Having no algorithm input parameters
|
|
43
|
-
job_details = JobDetails.load()
|
|
44
|
-
|
|
45
|
-
```
|
|
46
|
-
|
|
47
|
-
If our algorithm has custom input parameters and we want to load them into our algorithm, we can do it as follows:
|
|
48
|
-
|
|
49
|
-
```Python
|
|
50
|
-
|
|
51
|
-
from dataclasses import dataclass
|
|
52
|
-
from oceanprotocol_job_details import JobDetails
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
@dataclass
|
|
56
|
-
class InputParameters:
|
|
57
|
-
name: str
|
|
58
|
-
age: int
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
job_details: JobDetails[InputParameters] = JobDetails.load(InputParameters)
|
|
62
|
-
|
|
63
|
-
# Usage (is type hinted)
|
|
64
|
-
job_details.input_parameters.name
|
|
65
|
-
job_details.input_parameters.age
|
|
66
|
-
|
|
67
|
-
```
|
|
68
|
-
|
|
69
|
-
Assumes the directory structure of OceanProtocol algorithms.
|
|
70
|
-
|
|
71
|
-
### Core functionalities
|
|
72
|
-
|
|
73
|
-
Given the Ocean Protocol job details structure, parses the passed algorithm parameters into an object to use in your algorithms.
|
|
74
|
-
|
|
75
|
-
1. Input parameter JSON parsing and validation
|
|
76
|
-
1. Metadata and service extraction from the directory structure.
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
A Python package to get details from OceanProtocol jobs
|
|
2
|
-
|
|
3
|
-
---
|
|
4
|
-
|
|
5
|
-
## Installation
|
|
6
|
-
|
|
7
|
-
```
|
|
8
|
-
pip install oceanprotocol-job-details
|
|
9
|
-
```
|
|
10
|
-
|
|
11
|
-
## Usage
|
|
12
|
-
|
|
13
|
-
As a simple library, we only need to import the main object and use it once:
|
|
14
|
-
|
|
15
|
-
```Python
|
|
16
|
-
from oceanprotocol_job_details import JobDetails
|
|
17
|
-
|
|
18
|
-
# Having no algorithm input parameters
|
|
19
|
-
job_details = JobDetails.load()
|
|
20
|
-
|
|
21
|
-
```
|
|
22
|
-
|
|
23
|
-
If our algorithm has custom input parameters and we want to load them into our algorithm, we can do it as follows:
|
|
24
|
-
|
|
25
|
-
```Python
|
|
26
|
-
|
|
27
|
-
from dataclasses import dataclass
|
|
28
|
-
from oceanprotocol_job_details import JobDetails
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
@dataclass
|
|
32
|
-
class InputParameters:
|
|
33
|
-
name: str
|
|
34
|
-
age: int
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
job_details: JobDetails[InputParameters] = JobDetails.load(InputParameters)
|
|
38
|
-
|
|
39
|
-
# Usage (is type hinted)
|
|
40
|
-
job_details.input_parameters.name
|
|
41
|
-
job_details.input_parameters.age
|
|
42
|
-
|
|
43
|
-
```
|
|
44
|
-
|
|
45
|
-
Assumes the directory structure of OceanProtocol algorithms.
|
|
46
|
-
|
|
47
|
-
### Core functionalities
|
|
48
|
-
|
|
49
|
-
Given the Ocean Protocol job details structure, parses the passed algorithm parameters into an object to use in your algorithms.
|
|
50
|
-
|
|
51
|
-
1. Input parameter JSON parsing and validation
|
|
52
|
-
1. Metadata and service extraction from the directory structure.
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{oceanprotocol_job_details-0.2.5 → oceanprotocol_job_details-0.2.6}/oceanprotocol_job_details/di.py
RENAMED
|
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
|