fix: resume CBB batches after verified native release

This commit is contained in:
阿白叔 committed 2026-11-25 09:28:05 +08:00
1 parent c76b755f13
commit 5bab125122
18 files changed
+642 -60

No files matched your search

+19 -11
View File
@@ -1135,24 +1135,28 @@ def _open_catalog_manager_library(pid):
def _check_catalog_owners(library, processes):
"""A foreign LM is compatible only with a disjoint library and free target resources."""
"""Screen existing managers before starting a separately owned catalog instance."""
library = Path(library).resolve()
manager_pids = [pid for pid, *_ in processes]
target_dependencies = _catalog_shared_dependencies(library)
observed_libraries = {}
for pid in manager_pids:
try:
current = _open_catalog_manager_library(pid)
if current is None:
detail = '无法确认已运行的 Library Manager 对应哪个库'
# Some existing managers expose no absolute path in their title.
# Probe the target resources and enforce private COM ownership at launch.
observed_libraries[pid] = None
continue
other = current.resolve(strict=True)
if library.samefile(other):
detail = '当前库已在另一个 Library Manager 中打开'
elif any(left[2] == right[2] or (left[1] and left[:2] == right[:2])
for left in target_dependencies for right in _catalog_shared_dependencies(other)):
detail = '另一个 Library Manager 正在使用相同的共享符号库'
else:
other = current.resolve(strict=True)
if library.samefile(other):
detail = '当前库已在另一个 Library Manager 中打开'
elif any(left[2] == right[2] or (left[1] and left[:2] == right[:2])
for left in target_dependencies for right in _catalog_shared_dependencies(other)):
detail = '另一个 Library Manager 正在使用相同的共享符号库'
else:
continue
observed_libraries[pid] = str(other)
continue
except (OSError, ValueError) as error:
detail = f'无法确认另一中心库的资源范围:{error}'
raise NativeOperationError(f'LIBRARY_MANAGER_BUSY: PID {pid} · {detail}。',
@@ -1162,6 +1166,7 @@ def _check_catalog_owners(library, processes):
except OSError as error:
raise NativeOperationError(f'LIBRARY_MANAGER_BUSY: PID {manager_pids} · 当前库资源占用未确认:{error}',
safe_to_continue=True, blocking_manager_pids=manager_pids) from error
return observed_libraries
def _catalog_native(job, root):
@@ -1200,6 +1205,7 @@ def _catalog_com(job, root):
if name != job['desktop'] or not name.startswith('CbbManagement_'):
raise RuntimeError('拒绝在非本次私有桌面读取原生目录。')
previous_managers = _process_details('LibraryManager.exe')
existing_libraries = {}
if previous_managers:
if job.get('worker_role') != 'catalog_readonly' or job.get('include_engineering_identity', True):
raise RuntimeError('LIBRARY_MANAGER_BUSY: 已有 Library Manager 运行,请关闭后重试。')
@@ -1208,7 +1214,7 @@ def _catalog_com(job, root):
pids = sorted(pid for pid, *_ in previous_managers)
raise NativeOperationError(f'LIBRARY_MANAGER_BUSY: PID {pids} · 当前安装尚未验证并行目录读取。',
safe_to_continue=True, blocking_manager_pids=pids)
_check_catalog_owners(job['library'], previous_managers)
existing_libraries = _check_catalog_owners(job['library'], previous_managers)
except Exception as error:
error.safe_to_continue = True
raise
@@ -1257,6 +1263,8 @@ def _catalog_com(job, root):
continue
app = library = None
result = {'success': False, 'safe_to_continue': False}
if existing_libraries:
result['existing_manager_libraries'] = existing_libraries
watcher = None
try:
_require_management_continuation(job, root)