fix: finish current management item before stopping its batch

This commit is contained in:
阿白叔 committed 2026-11-17 04:53:30 +08:00
1 parent fd50805380
commit e0bb2438e8
5 files changed
+178 -7

No files matched your search

+4 -2
View File
@@ -465,7 +465,8 @@ def run_management(request, *, adapter=None, verifier=None, idle_check=None, pro
def run_management_batch(requests, *, stop=None, progress=None, item_executor=None, context=None, **kwargs):
from threading import Event
from .write_admission import WriteAdmission
from .operation_queue import QueueCancelled, TaskHandoff, request_library_keys, remember_result
from .operation_queue import QueueCancelled, TaskHandoff, request_library_keys, remember_result, current_context
context = context or current_context()
if context is not None:
stop = stop if stop is not None else context.stop
progress = context.guard_callback(progress) if progress else None
@@ -477,7 +478,8 @@ def run_management_batch(requests, *, stop=None, progress=None, item_executor=No
cancelled = False
for request in requests:
keys = request_library_keys(request, context)
stopped = cancelled or stop.is_set() or context is not None and context.stop.is_set()
stopped = (cancelled or stop.is_set() or context is not None
and (context.stop.is_set() or context.stop_after_current.is_set()))
if stopped or keys.intersection(retained_libraries):
result = ManagementResult(request.operation, request.library, request.name, request.partition,
request.source, request.auto_verify, 'complete', 'SKIPPED', True,