oceanprotocol-job-details 0.2.0__py3-none-any.whl → 0.2.1__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.
- oceanprotocol_job_details/__init__.py +4 -0
- oceanprotocol_job_details/ocean.py +11 -4
- {oceanprotocol_job_details-0.2.0.dist-info → oceanprotocol_job_details-0.2.1.dist-info}/METADATA +12 -20
- {oceanprotocol_job_details-0.2.0.dist-info → oceanprotocol_job_details-0.2.1.dist-info}/RECORD +6 -6
- {oceanprotocol_job_details-0.2.0.dist-info → oceanprotocol_job_details-0.2.1.dist-info}/WHEEL +0 -0
- {oceanprotocol_job_details-0.2.0.dist-info → oceanprotocol_job_details-0.2.1.dist-info}/licenses/LICENSE +0 -0
|
@@ -264,7 +264,13 @@ class JobDetails(Generic[T]):
|
|
|
264
264
|
) from e
|
|
265
265
|
|
|
266
266
|
@classmethod
|
|
267
|
-
def load(
|
|
267
|
+
def load(
|
|
268
|
+
cls,
|
|
269
|
+
_type: Type[T] | None = None,
|
|
270
|
+
dids: str | None = None,
|
|
271
|
+
transformation_did: str | None = None,
|
|
272
|
+
secret: str | None = None,
|
|
273
|
+
) -> JobDetails[T]:
|
|
268
274
|
"""Load a JobDetails instance that holds the runtime details.
|
|
269
275
|
|
|
270
276
|
Loading it will check the following:
|
|
@@ -284,9 +290,10 @@ class JobDetails(Generic[T]):
|
|
|
284
290
|
container = Container()
|
|
285
291
|
container.config.from_dict(
|
|
286
292
|
{
|
|
287
|
-
"dids": os.environ.get("DIDS"),
|
|
288
|
-
"transformation_did":
|
|
289
|
-
|
|
293
|
+
"dids": dids or os.environ.get("DIDS"),
|
|
294
|
+
"transformation_did": transformation_did
|
|
295
|
+
or os.environ.get("TRANSFORMATION_DID"),
|
|
296
|
+
"secret": secret or os.environ.get("SECRET"),
|
|
290
297
|
}
|
|
291
298
|
)
|
|
292
299
|
|
{oceanprotocol_job_details-0.2.0.dist-info → oceanprotocol_job_details-0.2.1.dist-info}/METADATA
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: oceanprotocol-job-details
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.1
|
|
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
|
|
@@ -37,10 +37,10 @@ pip install oceanprotocol-job-details
|
|
|
37
37
|
As a simple library, we only need to import the main object and use it once:
|
|
38
38
|
|
|
39
39
|
```Python
|
|
40
|
-
from oceanprotocol_job_details
|
|
40
|
+
from oceanprotocol_job_details import JobDetails
|
|
41
41
|
|
|
42
42
|
# Having no algorithm input parameters
|
|
43
|
-
job_details =
|
|
43
|
+
job_details = JobDetails.load()
|
|
44
44
|
|
|
45
45
|
```
|
|
46
46
|
|
|
@@ -49,15 +49,16 @@ If our algorithm has custom input parameters and we want to load them into our a
|
|
|
49
49
|
```Python
|
|
50
50
|
|
|
51
51
|
from dataclasses import dataclass
|
|
52
|
-
from oceanprotocol_job_details
|
|
53
|
-
|
|
52
|
+
from oceanprotocol_job_details import JobDetails
|
|
53
|
+
|
|
54
54
|
|
|
55
55
|
@dataclass
|
|
56
|
-
class
|
|
56
|
+
class InputParameters:
|
|
57
57
|
name: str
|
|
58
58
|
age: int
|
|
59
59
|
|
|
60
|
-
|
|
60
|
+
|
|
61
|
+
job_details: JobDetails[InputParameters] = JobDetails.load(InputParameters)
|
|
61
62
|
|
|
62
63
|
# Usage (is type hinted)
|
|
63
64
|
job_details.input_parameters.name
|
|
@@ -65,20 +66,11 @@ job_details.input_parameters.age
|
|
|
65
66
|
|
|
66
67
|
```
|
|
67
68
|
|
|
68
|
-
Assumes the
|
|
69
|
-
```
|
|
70
|
-
<ROOT_FOLDER>
|
|
71
|
-
└───data
|
|
72
|
-
├───ddos
|
|
73
|
-
├───transformation
|
|
74
|
-
├───inputs
|
|
75
|
-
└───logs
|
|
76
|
-
```
|
|
69
|
+
Assumes the directory structure of OceanProtocol algorithms.
|
|
77
70
|
|
|
78
71
|
### Core functionalities
|
|
79
72
|
|
|
80
|
-
Given the Ocean Protocol job details structure
|
|
73
|
+
Given the Ocean Protocol job details structure, parses the passed algorithm parameters into an object to use in your algorithms.
|
|
81
74
|
|
|
82
|
-
1.
|
|
83
|
-
1.
|
|
84
|
-
1. Metadata and service extraction
|
|
75
|
+
1. Input parameter JSON parsing and validation
|
|
76
|
+
1. Metadata and service extraction from the directory structure.
|
{oceanprotocol_job_details-0.2.0.dist-info → oceanprotocol_job_details-0.2.1.dist-info}/RECORD
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
oceanprotocol_job_details/__init__.py,sha256=
|
|
1
|
+
oceanprotocol_job_details/__init__.py,sha256=ijnTgMStPChV4MUuJdfD1iNgev6m_HA8jqOMRWLVaPE,54
|
|
2
2
|
oceanprotocol_job_details/di.py,sha256=mLhxm-fiqC4TuPUIEG5eqsgmtmY3N64g6Ep8NgQR6pA,1131
|
|
3
|
-
oceanprotocol_job_details/ocean.py,sha256=
|
|
3
|
+
oceanprotocol_job_details/ocean.py,sha256=WB8xEw5y0G0klbbdgmJFZfaM62bw4nfvyuYU11lgw4g,6880
|
|
4
4
|
oceanprotocol_job_details/paths.py,sha256=gzWj8HPKjJAQ6FUjOobWWzrW1Kzpxq2bXxQ9icDAy24,723
|
|
5
5
|
oceanprotocol_job_details/loaders/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
6
6
|
oceanprotocol_job_details/loaders/loader.py,sha256=HIzsVKCuGP7ghfM7ppN3ANVybvsA64wr3h8I68mqS6A,195
|
|
@@ -8,7 +8,7 @@ oceanprotocol_job_details/loaders/impl/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JC
|
|
|
8
8
|
oceanprotocol_job_details/loaders/impl/ddo.py,sha256=_xl0PozuvIm0n6jU--Znk6qfw1A6OLBq3SERbDGIF74,844
|
|
9
9
|
oceanprotocol_job_details/loaders/impl/files.py,sha256=oFkA_0Ma5NBgWvVEk_rhyDIDrAam_zjesh0-bxZaIU8,1443
|
|
10
10
|
oceanprotocol_job_details/loaders/impl/job_details.py,sha256=wf0xNAG4tESq57vqkdtMQ8BdiyS91j5f7FL8Gfwbjh4,770
|
|
11
|
-
oceanprotocol_job_details-0.2.
|
|
12
|
-
oceanprotocol_job_details-0.2.
|
|
13
|
-
oceanprotocol_job_details-0.2.
|
|
14
|
-
oceanprotocol_job_details-0.2.
|
|
11
|
+
oceanprotocol_job_details-0.2.1.dist-info/METADATA,sha256=3SR7Vaho5NYku7wcWJjNslD9Z3IpxJ0GU4vTFyV4zWo,2948
|
|
12
|
+
oceanprotocol_job_details-0.2.1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
13
|
+
oceanprotocol_job_details-0.2.1.dist-info/licenses/LICENSE,sha256=ni3ix7P_GxK1W3VGC4fJ3o6QoCngCEpSuTJwO4nkpbw,1055
|
|
14
|
+
oceanprotocol_job_details-0.2.1.dist-info/RECORD,,
|
{oceanprotocol_job_details-0.2.0.dist-info → oceanprotocol_job_details-0.2.1.dist-info}/WHEEL
RENAMED
|
File without changes
|
|
File without changes
|