Forráskód Böngészése

refactor: allow for NOT_RUN status to be set

Sam Jaffe 4 hete
szülő
commit
08bce1a378
3 módosított fájl, 4 hozzáadás és 4 törlés
  1. 1 1
      src/cipy/action.py
  2. 1 1
      src/cipy/common.py
  3. 2 2
      src/cipy/workflow.py

+ 1 - 1
src/cipy/action.py

@@ -152,7 +152,7 @@ class Composite(Action):
 
     @final
     def run(self, context: Context) -> Status:
-        status = Status.SUCCESS
+        status = Status.NOT_RUN
 
         with context.extend(steps=self._results) as outctx:
             for step in self.steps:

+ 1 - 1
src/cipy/common.py

@@ -175,7 +175,7 @@ class Action(BaseModel, abc.ABC):
     # pylint: disable=unused-argument
     def enabled(self, status: Status, context: Context) -> bool:
         """Should this action even be run?"""
-        return status == Status.SUCCESS
+        return status.value <= Status.SUCCESS.value
 
     @abc.abstractmethod
     def run(self, context: Context) -> Status:

+ 2 - 2
src/cipy/workflow.py

@@ -41,7 +41,7 @@ class Workflow(Action):
 
     @final
     def run(self, context: Context) -> Status:
-        status = Status.SUCCESS
+        status = Status.NOT_RUN
         visited = set()
 
         def _next():
@@ -98,7 +98,7 @@ class Matrix(Action):
 
     @final
     def run(self, context: Context) -> Status:
-        status = Status.SUCCESS
+        status = Status.NOT_RUN
 
         for matrix in self._expand(context):
             self.logger.info("%r", matrix)