flows: fix planner removing too many stages

This commit is contained in:
Jens Langhammer 2020-09-26 14:58:13 +02:00
parent ae435f423e
commit 64a71a3663

View file

@ -46,22 +46,24 @@ class FlowPlan:
self.stages.append(stage) self.stages.append(stage)
self.markers.append(marker or StageMarker()) self.markers.append(marker or StageMarker())
def next(self, offset=0) -> Optional[Stage]: def next(self) -> Optional[Stage]:
"""Return next pending stage from the bottom of the list""" """Return next pending stage from the bottom of the list"""
if not self.has_stages: if not self.has_stages:
return None return None
stage = self.stages[offset] stage = self.stages[0]
marker = self.markers[offset] marker = self.markers[0]
if marker.__class__ is not StageMarker: if marker.__class__ is not StageMarker:
LOGGER.debug("f(plan_inst): stage has marker", stage=stage, marker=marker) LOGGER.debug("f(plan_inst): stage has marker", stage=stage, marker=marker)
marked_stage = marker.process(self, stage) marked_stage = marker.process(self, stage)
if not marked_stage: if not marked_stage:
LOGGER.debug("f(plan_inst): marker returned none, next stage", stage=stage) LOGGER.debug("f(plan_inst): marker returned none, next stage", stage=stage)
self.stages.remove(stage)
self.markers.remove(marker)
if not self.has_stages: if not self.has_stages:
return None return None
# pylint: disable=not-callable # pylint: disable=not-callable
return self.next(offset + 1) return self.next()
return marked_stage return marked_stage
def pop(self): def pop(self):