ocean-runner 0.2.8__py3-none-any.whl → 0.2.10__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.
ocean_runner/config.py CHANGED
@@ -31,11 +31,6 @@ class Environment:
31
31
  )
32
32
  """Super secret secret"""
33
33
 
34
- runtime: Literal["dev", "test"] = field(
35
- default_factory=lambda: os.environ.get("RUNTIME", "dev").lower()
36
- )
37
- """Select runtime mode"""
38
-
39
34
  dict = asdict
40
35
 
41
36
 
ocean_runner/runner.py CHANGED
@@ -8,7 +8,6 @@ from typing import Callable, Generic, Self, TypeVar
8
8
  from oceanprotocol_job_details import JobDetails
9
9
 
10
10
  from ocean_runner.config import Config
11
- from ocean_runner.runtime_mode import RuntimeMode
12
11
 
13
12
  JobDetailsT = TypeVar(
14
13
  "JobDetailsT",
@@ -34,19 +33,6 @@ def default_save(*, result: ResultT, base: Path, algorithm: Algorithm) -> None:
34
33
  f.write(str(result))
35
34
 
36
35
 
37
- def default_test_run(algorithm: Algorithm) -> int:
38
- import pytest
39
-
40
- result = pytest.main()
41
-
42
- if result == 0:
43
- algorithm.logger.info("Passed all tests")
44
- else:
45
- algorithm.logger.error("Some tests failed")
46
-
47
- return result
48
-
49
-
50
36
  @dataclass
51
37
  class Algorithm(Generic[JobDetailsT, ResultT]):
52
38
 
@@ -57,7 +43,6 @@ class Algorithm(Generic[JobDetailsT, ResultT]):
57
43
 
58
44
  _job_details: JobDetails[JobDetailsT] = field(init=False)
59
45
  _result: ResultT | None = field(default=None, init=False)
60
- _runtime: RuntimeMode = field(default=RuntimeMode.DEV, init=False)
61
46
 
62
47
  error_callback = default_error_callback
63
48
 
@@ -89,8 +74,6 @@ class Algorithm(Generic[JobDetailsT, ResultT]):
89
74
  sys.path.extend([str(path.absolute()) for path in config.source_paths])
90
75
  self.logger.debug(f"Added [{len(config.source_paths)}] entries to PATH")
91
76
 
92
- self._runtime = RuntimeMode(config.environment.runtime) or self._runtime
93
-
94
77
  self._job_details = JobDetails.load(
95
78
  _type=config.custom_input,
96
79
  base_dir=config.environment.base_dir,
@@ -116,7 +99,10 @@ class Algorithm(Generic[JobDetailsT, ResultT]):
116
99
  raise Algorithm.Error("Result missing, run the algorithm first")
117
100
  return self._result
118
101
 
119
- def validate(self, callback: Callable[[Self], None] = default_validation) -> Self:
102
+ def validate(
103
+ self,
104
+ callback: Callable[[Self], None] = default_validation,
105
+ ) -> Self:
120
106
  self.logger.info("Validating instance...")
121
107
  try:
122
108
  callback(self)
@@ -125,12 +111,12 @@ class Algorithm(Generic[JobDetailsT, ResultT]):
125
111
 
126
112
  return self
127
113
 
128
- def run(self, callable: Callable[[Self], ResultT], is_check_test=True) -> Self:
114
+ def run(
115
+ self,
116
+ callable: Callable[[Self], ResultT],
117
+ ) -> Self:
129
118
  self.logger.info("Running algorithm...")
130
119
  try:
131
- if is_check_test and self._runtime == RuntimeMode.TEST:
132
- callable = default_test_run
133
-
134
120
  self._result = callable(self)
135
121
  except Exception as e:
136
122
  self.error_callback(e)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ocean-runner
3
- Version: 0.2.8
3
+ Version: 0.2.10
4
4
  Summary: A fluent API for OceanProtocol algorithms
5
5
  Project-URL: Homepage, https://github.com/AgrospAI/ocean-runner
6
6
  Project-URL: Issues, https://github.com/AgrospAI/ocean-runner/issues
@@ -134,11 +134,6 @@ Algorithm(
134
134
  """
135
135
  Random secret to use while testing.
136
136
  """
137
-
138
- runtime: "dev",
139
- """
140
- Runtime mode. "dev" to run normally, "test" to run pytest
141
- """
142
137
  )
143
138
  """
144
139
  Should not be needed in production algorithms, used to mock environment variables, defaults to using env.
@@ -197,4 +192,3 @@ Environment variables:
197
192
  - `TRANSFORMATION_DID` Algorithm DID, must have format: `abc..90`
198
193
  - `SECRET` Algorithm secret.
199
194
  - `BASE_DIR` (optional, default="/data"): Base path to the OceanProtocol data directories.
200
- - `RUNTIME` (optional, default="dev"): Runtime mode
@@ -0,0 +1,7 @@
1
+ ocean_runner/__init__.py,sha256=awAmE6kZhuwcrD3gT7qFZArdhiuzW-EFTA6tGKhw06k,138
2
+ ocean_runner/config.py,sha256=-9ZOOHSDRtYEgPXXP3SWcL3d0Wcpa1QUZQziqfJ55_w,1489
3
+ ocean_runner/runner.py,sha256=76PzU9UqcVSQsoo3ILRR-hSRqitCc9jCX3Ci9Kc2P2c,4071
4
+ ocean_runner-0.2.10.dist-info/METADATA,sha256=MrfKG8cNunt6FoGkdOcUe-N90xzSCkLLQUZzqOGScyk,5919
5
+ ocean_runner-0.2.10.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
6
+ ocean_runner-0.2.10.dist-info/licenses/LICENSE,sha256=_B25KqK4amoADWkMN150tnZFm_Fy7VvZpvIC8ZydWdI,1053
7
+ ocean_runner-0.2.10.dist-info/RECORD,,
@@ -1,6 +0,0 @@
1
- from enum import Enum
2
-
3
-
4
- class RuntimeMode(Enum):
5
- DEV = "dev"
6
- TEST = "test"
@@ -1,8 +0,0 @@
1
- ocean_runner/__init__.py,sha256=awAmE6kZhuwcrD3gT7qFZArdhiuzW-EFTA6tGKhw06k,138
2
- ocean_runner/config.py,sha256=zzpGxotGhGnNdHKFJqQ7fuXK5zW2IGOpzftHilcySD4,1644
3
- ocean_runner/runner.py,sha256=nneFJvbcUdD31cl15_y7oyKl1Qg9xFHKZguUFdVKjZw,4612
4
- ocean_runner/runtime_mode.py,sha256=WbGTaoL3hxBWbxM8luwyOwwtQonqyIhbus0_Jd-F-3k,83
5
- ocean_runner-0.2.8.dist-info/METADATA,sha256=ns4PJ7bUu0NbD4CyRoQcqfc56zfCl7ECjuCeW5HACcU,6101
6
- ocean_runner-0.2.8.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
7
- ocean_runner-0.2.8.dist-info/licenses/LICENSE,sha256=_B25KqK4amoADWkMN150tnZFm_Fy7VvZpvIC8ZydWdI,1053
8
- ocean_runner-0.2.8.dist-info/RECORD,,