fix: address code review feedback
- Add exception handling in run_pipeline to catch unexpected errors - Remove dead code in THTest (self.name check that never executes) - Add timeout and concurrency limit tests to test_textfx_runtime_limits.py
This commit is contained in:
@ -563,12 +563,20 @@ class PipelineRunner:
|
||||
results: list[TextHandleResult] = []
|
||||
|
||||
for statement in pipeline.statements:
|
||||
if isinstance(statement, IfNode):
|
||||
results.append(await self._execute_if(statement, istream, env))
|
||||
elif isinstance(statement, WhileNode):
|
||||
results.append(await self._execute_while(statement, istream, env))
|
||||
else:
|
||||
results.append(await self._execute_group(statement, istream, env))
|
||||
try:
|
||||
if isinstance(statement, IfNode):
|
||||
results.append(await self._execute_if(statement, istream, env))
|
||||
elif isinstance(statement, WhileNode):
|
||||
results.append(await self._execute_while(statement, istream, env))
|
||||
else:
|
||||
results.append(await self._execute_group(statement, istream, env))
|
||||
except Exception as e:
|
||||
logger.error(f"Pipeline execution failed: {e}")
|
||||
logger.exception(e)
|
||||
results.append(
|
||||
TextHandleResult(code=-1, ostream="处理流水线时出现 python 错误")
|
||||
)
|
||||
return results
|
||||
|
||||
return results
|
||||
|
||||
|
||||
@ -118,9 +118,8 @@ class THTest(TextHandler):
|
||||
self, env: TextHandlerEnvironment, istream: str | None, args: list[str]
|
||||
) -> TextHandleResult:
|
||||
expr = list(args)
|
||||
if self.name == "[":
|
||||
pass
|
||||
|
||||
# 支持方括号语法:[ expr ] 会自动移除末尾的 ]
|
||||
if expr and expr[-1] == "]":
|
||||
expr = expr[:-1]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user