oceanprotocol-job-details 0.2.0__py3-none-any.whl → 0.2.2__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.
@@ -0,0 +1,4 @@
1
+ from .ocean import JobDetails
2
+
3
+
4
+ __all__ = [JobDetails]
@@ -264,7 +264,13 @@ class JobDetails(Generic[T]):
264
264
  ) from e
265
265
 
266
266
  @classmethod
267
- def load(cls, _type: Type[T] | None = None) -> JobDetails[T]:
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": os.environ.get("TRANSFORMATION_DID"),
289
- "secret": os.environ.get("SECRET"),
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
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: oceanprotocol-job-details
3
- Version: 0.2.0
3
+ Version: 0.2.2
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.job_details import OceanProtocolJobDetails
40
+ from oceanprotocol_job_details import JobDetails
41
41
 
42
42
  # Having no algorithm input parameters
43
- job_details = OceanProtocolJobDetails().load() # type: ignore
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.job_details import OceanProtocolJobDetails
53
- from oceanprotocol_job_details.ocean import JobDetails
52
+ from oceanprotocol_job_details import JobDetails
53
+
54
54
 
55
55
  @dataclass
56
- class Input:
56
+ class InputParameters:
57
57
  name: str
58
58
  age: int
59
59
 
60
- job_details: JobDetails[Input] = OceanProtocolJobDetails(Input).load()
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 following directory structure:
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 as in [https://github.com/GX4FM-Base-X/pontus-x-ontology](Pontus-X Ontology), parses the passed algorithm parameters into an object to use in your algorithms.
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. Parsing JSON
83
- 1. Validation
84
- 1. Metadata and service extraction
75
+ 1. Input parameter JSON parsing and validation
76
+ 1. Metadata and service extraction from the directory structure.
@@ -1,6 +1,6 @@
1
- oceanprotocol_job_details/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
1
+ oceanprotocol_job_details/__init__.py,sha256=C67wv7fy5ZT5FtbGD-oQeSoLU-x6e2ts-820koFo034,55
2
2
  oceanprotocol_job_details/di.py,sha256=mLhxm-fiqC4TuPUIEG5eqsgmtmY3N64g6Ep8NgQR6pA,1131
3
- oceanprotocol_job_details/ocean.py,sha256=l-MunbeDBZhPATLZL5nKyo2i7RAznTqMRjY-wJEkxVw,6686
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.0.dist-info/METADATA,sha256=1oFkqVCvdw0vue35sCM2EmkfbLFcwTIwptJLHxFo4DY,3214
12
- oceanprotocol_job_details-0.2.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
13
- oceanprotocol_job_details-0.2.0.dist-info/licenses/LICENSE,sha256=ni3ix7P_GxK1W3VGC4fJ3o6QoCngCEpSuTJwO4nkpbw,1055
14
- oceanprotocol_job_details-0.2.0.dist-info/RECORD,,
11
+ oceanprotocol_job_details-0.2.2.dist-info/METADATA,sha256=cz9Y5MwTyD0Lz-snU0rEF6H1HjdMKKrMp070fMclLiE,2948
12
+ oceanprotocol_job_details-0.2.2.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
13
+ oceanprotocol_job_details-0.2.2.dist-info/licenses/LICENSE,sha256=ni3ix7P_GxK1W3VGC4fJ3o6QoCngCEpSuTJwO4nkpbw,1055
14
+ oceanprotocol_job_details-0.2.2.dist-info/RECORD,,