fix: stop batch when native session recovery is exhausted
This commit is contained in:
1 parent
a011e8eab6
commit
2c88be99ce
3 files changed
+54
-2
No files matched your search
@@ -166,9 +166,12 @@ class NativeInventoryReader:
|
||||
if record['state'] == 'uncertain':
|
||||
raise TaskCenterError('inventory_cleanup', f'原生采集清理状态不确定:{evidence}') from error
|
||||
_verify_sources(source_hashes)
|
||||
record.update(source_hashes_unchanged=True,
|
||||
source_hashes={str(path): digest for path, digest in source_hashes.items()})
|
||||
retry = False
|
||||
cleanup = getattr(desktop, 'cleanup_record', None)
|
||||
if (allow_retry and isinstance(error, _NativeInventoryProcessError)
|
||||
session_failure = runtime is not None and isinstance(error, _NativeInventoryProcessError)
|
||||
if (session_failure
|
||||
and clean and isinstance(cleanup, dict) and cleanup.get('workers_closed') is True):
|
||||
check_cancelled(stop_event)
|
||||
from .batch_resources import write_record
|
||||
@@ -179,7 +182,12 @@ class NativeInventoryReader:
|
||||
'binding': dict(desktop.identity),
|
||||
})
|
||||
_verify_sources(source_hashes)
|
||||
retry = runtime.recover_native_failure(project, evidence, str(error))
|
||||
if allow_retry:
|
||||
retry = runtime.recover_native_failure(project, evidence, str(error))
|
||||
if session_failure and not retry:
|
||||
record.update(state='session_failed', reason=str(error))
|
||||
raise TaskCenterError('inventory_session',
|
||||
f'原生读取会话异常,未能完成安全重试,批次已停止。请保留诊断记录后排查:{evidence};{error}') from error
|
||||
record.update(state='retrying' if retry else 'fallback', reason=str(error))
|
||||
if retry:
|
||||
result = _RETRY_NATIVE_READ
|
||||
|
||||
@@ -5,6 +5,7 @@ import re
|
||||
|
||||
ERROR_TEXT = {
|
||||
"batch_resources_pending": "已核验的替换结果已保留。后台资源尚未释放,请使用“重新清理资源”后再开始下一批。",
|
||||
"inventory_session": "原生读取会话异常,安全重试未完成,已停止本批处理。请查看诊断记录并排除原因后重试。",
|
||||
"task_required": "请先选择任务。",
|
||||
"directory_required": "请先选择工程目录。",
|
||||
"discovery_root_locked": "旧目录已有执行记录,不能在同一任务中更换目录;请新建任务。",
|
||||
|
||||
Reference in new issue
Block a user