ocean-runner 0.2.7__tar.gz → 0.2.9__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ocean-runner
3
- Version: 0.2.7
3
+ Version: 0.2.9
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
@@ -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]) -> 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 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
  [project]
2
2
  name = "ocean-runner"
3
- version = "0.2.7"
3
+ version = "0.2.9"
4
4
  description = "A fluent API for OceanProtocol algorithms"
5
5
  authors = [
6
6
  { name = "AgrospAI", email = "agrospai@udl.cat" },
@@ -1,6 +0,0 @@
1
- from enum import Enum
2
-
3
-
4
- class RuntimeMode(Enum):
5
- DEV = "dev"
6
- TEST = "test"
File without changes
File without changes
File without changes