diff --git a/app/pipeline/competency_extraction_pipeline.py b/app/pipeline/competency_extraction_pipeline.py index 99ac0a28..c569f704 100644 --- a/app/pipeline/competency_extraction_pipeline.py +++ b/app/pipeline/competency_extraction_pipeline.py @@ -79,12 +79,12 @@ def __call__( competency = competency[start:end] try: competency = self.output_parser.parse(competency) - logger.debug(f"Generated competency: {competency}") - generated_competencies.append(competency) - self.callback.done(final_result=generated_competencies) except Exception as e: - logger.debug(f"Error generating competency: {e}") - self.callback.error(f"Error generating competency: {e}") + logger.debug(f"Error parsing competency: {e}") + continue + logger.debug(f"Generated competency: {competency}") + generated_competencies.append(competency) + self.callback.done(final_result=generated_competencies) # Mark all remaining competencies as skipped for i in range(len(generated_competencies), len(competencies)): self.callback.skip(f"Skipping competency {i + 1}") diff --git a/app/web/status/status_update.py b/app/web/status/status_update.py index abc2b1a5..979d0956 100644 --- a/app/web/status/status_update.py +++ b/app/web/status/status_update.py @@ -104,24 +104,19 @@ def done( If there is a next stage, set the current stage to the next stage. """ - if self.stage.state == StageStateEnum.IN_PROGRESS: - self.stage.state = StageStateEnum.DONE - self.stage.message = message - self.status.result = final_result - if hasattr(self.status, "suggestions"): - self.status.suggestions = suggestions - next_stage = self.get_next_stage() - if next_stage is not None: - self.stage = next_stage - if next_stage_message: - self.stage.message = next_stage_message - if start_next_stage: - self.stage.state = StageStateEnum.IN_PROGRESS - self.on_status_update() - else: - raise ValueError( - "Invalid state transition to done. current state is ", self.stage.state - ) + self.stage.state = StageStateEnum.DONE + self.stage.message = message + self.status.result = final_result + if hasattr(self.status, "suggestions"): + self.status.suggestions = suggestions + next_stage = self.get_next_stage() + if next_stage is not None: + self.stage = next_stage + if next_stage_message: + self.stage.message = next_stage_message + if start_next_stage: + self.stage.state = StageStateEnum.IN_PROGRESS + self.on_status_update() def error(self, message: str, exception=None): """ @@ -131,7 +126,6 @@ def error(self, message: str, exception=None): self.stage.state = StageStateEnum.ERROR self.stage.message = message self.status.result = None - self.stage.suggestions = None # Set all subsequent stages to SKIPPED if an error occurs rest_of_index = ( self.current_stage_index + 1