oceanprotocol-job-details 0.2.1__py3-none-any.whl → 0.2.3__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.
@@ -1,4 +1,4 @@
1
- from ocean import JobDetails
1
+ from .ocean import JobDetails
2
2
 
3
3
 
4
4
  __all__ = [JobDetails]
@@ -10,7 +10,10 @@ class Container(containers.DeclarativeContainer):
10
10
 
11
11
  config = providers.Configuration()
12
12
 
13
- paths = providers.Singleton(Paths)
13
+ paths = providers.Singleton(
14
+ Paths,
15
+ base_dir=config.base_dirs,
16
+ )
14
17
 
15
18
  file_loader = providers.Factory(
16
19
  FilesLoader,
@@ -267,6 +267,8 @@ class JobDetails(Generic[T]):
267
267
  def load(
268
268
  cls,
269
269
  _type: Type[T] | None = None,
270
+ *,
271
+ base_dir: str | None = None,
270
272
  dids: str | None = None,
271
273
  transformation_did: str | None = None,
272
274
  secret: str | None = None,
@@ -278,6 +280,7 @@ class JobDetails(Generic[T]):
278
280
  1. That the ocean protocol contains the needed data based on the passed environment variables.
279
281
 
280
282
  Those needed environment variables are:
283
+ - BASE_DIR: Base directory to read the data from, parent of the ddos, inputs, outputs and logs directories.
281
284
  - DIDS: The DIDs of the inputs
282
285
  - TRANSFORMATION_DID: The DID of the transformation algorithm
283
286
  - SECRET (optional): A really secret secret
@@ -290,6 +293,7 @@ class JobDetails(Generic[T]):
290
293
  container = Container()
291
294
  container.config.from_dict(
292
295
  {
296
+ "base_dir": base_dir or os.environ.get("BASE_DIR", None),
293
297
  "dids": dids or os.environ.get("DIDS"),
294
298
  "transformation_did": transformation_did
295
299
  or os.environ.get("TRANSFORMATION_DID"),
@@ -1,28 +1,38 @@
1
- from dataclasses import dataclass
2
- from logging import getLogger
1
+ from dataclasses import InitVar, dataclass, field
3
2
  from pathlib import Path
4
3
 
5
- logger = getLogger(__name__)
6
-
7
4
 
8
5
  @dataclass
9
6
  class Paths:
10
7
  """Configuration class for the Ocean Protocol Job Details"""
11
8
 
12
- data: Path = Path("/data")
13
- """The path to the data directory"""
9
+ base_dir: InitVar[Path | None]
10
+
11
+ _base: Path = field(init=False)
12
+
13
+ def __post_init__(self, base_dir: Path | None) -> None:
14
+ self._base = base_dir or Path("/data")
15
+
16
+ @property
17
+ def data(self) -> Path:
18
+ return self._base
14
19
 
15
- inputs: Path = data / "inputs"
16
- """The path to the inputs directory"""
20
+ @property
21
+ def inputs(self) -> Path:
22
+ return self.data / "inputs"
17
23
 
18
- ddos: Path = data / "ddos"
19
- """The path to the DDOs directory"""
24
+ @property
25
+ def ddos(self) -> Path:
26
+ return self.data / "ddos"
20
27
 
21
- outputs: Path = data / "outputs"
22
- """The path to the outputs directory"""
28
+ @property
29
+ def outputs(self) -> Path:
30
+ return self.data / "outputs"
23
31
 
24
- logs: Path = data / "logs"
25
- """The path to the logs directory"""
32
+ @property
33
+ def logs(self) -> Path:
34
+ return self.data / "logs"
26
35
 
27
- algorithm_custom_parameters: Path = inputs / "algoCustomData.json"
28
- """The path to the algorithm's custom parameters file"""
36
+ @property
37
+ def algorithm_custom_parameters(self) -> Path:
38
+ return self.inputs / "algoCustomData.json"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: oceanprotocol-job-details
3
- Version: 0.2.1
3
+ Version: 0.2.3
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
@@ -1,14 +1,14 @@
1
- oceanprotocol_job_details/__init__.py,sha256=ijnTgMStPChV4MUuJdfD1iNgev6m_HA8jqOMRWLVaPE,54
2
- oceanprotocol_job_details/di.py,sha256=mLhxm-fiqC4TuPUIEG5eqsgmtmY3N64g6Ep8NgQR6pA,1131
3
- oceanprotocol_job_details/ocean.py,sha256=WB8xEw5y0G0klbbdgmJFZfaM62bw4nfvyuYU11lgw4g,6880
4
- oceanprotocol_job_details/paths.py,sha256=gzWj8HPKjJAQ6FUjOobWWzrW1Kzpxq2bXxQ9icDAy24,723
1
+ oceanprotocol_job_details/__init__.py,sha256=C67wv7fy5ZT5FtbGD-oQeSoLU-x6e2ts-820koFo034,55
2
+ oceanprotocol_job_details/di.py,sha256=Pt3qVL3n2aAyGTUzg6iYoEUbLS8S-LqKf2OlIDhhUmg,1181
3
+ oceanprotocol_job_details/ocean.py,sha256=-LdztJ2h1WS9OVWVzc8jAfLcxhzJ9Zqsn8Rk0d7SZOo,7118
4
+ oceanprotocol_job_details/paths.py,sha256=N90IF8OQCBELULGPaBv9yALApa-lC2dsVKXMWLdqa14,851
5
5
  oceanprotocol_job_details/loaders/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
6
6
  oceanprotocol_job_details/loaders/loader.py,sha256=HIzsVKCuGP7ghfM7ppN3ANVybvsA64wr3h8I68mqS6A,195
7
7
  oceanprotocol_job_details/loaders/impl/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
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.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,,
11
+ oceanprotocol_job_details-0.2.3.dist-info/METADATA,sha256=FOIlcWo4XHshMnKle-BE0gxXaqBBGq2c6N1oihZjd0I,2948
12
+ oceanprotocol_job_details-0.2.3.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
13
+ oceanprotocol_job_details-0.2.3.dist-info/licenses/LICENSE,sha256=ni3ix7P_GxK1W3VGC4fJ3o6QoCngCEpSuTJwO4nkpbw,1055
14
+ oceanprotocol_job_details-0.2.3.dist-info/RECORD,,