mirror of
https://github.com/AUTOMATIC1111/stable-diffusion-webui.git
synced 2026-03-24 07:01:13 -07:00
- Refactor ProcessingRunner.run() to delegate through lifecycle stages - Add prepare(), execute(), finalize() with pass-through behavior - Add test_runner_lifecycle_order contract test - Preserve identical behavior; no API/CLI changes Phase III — Runner & Service Boundary Made-with: Cursor
38 lines
1.2 KiB
Python
38 lines
1.2 KiB
Python
"""ProcessingRunner — unified execution entrypoint for Serena pipeline.
|
|
|
|
M10: Thin adapter around process_images_inner. No behavior changes.
|
|
M11: Lifecycle surface (prepare → execute → finalize). Pass-through behavior.
|
|
"""
|
|
|
|
|
|
class ProcessingRequest:
|
|
"""Wraps StableDiffusionProcessing for runner boundary."""
|
|
|
|
def __init__(self, processing):
|
|
self.processing = processing
|
|
|
|
|
|
class ProcessingRunner:
|
|
"""
|
|
Unified execution entrypoint for Serena processing pipeline.
|
|
M11: Exposes lifecycle stages for future instrumentation.
|
|
"""
|
|
|
|
def run(self, request):
|
|
"""Execute processing pipeline via lifecycle stages."""
|
|
state = self.prepare(request)
|
|
result = self.execute(state)
|
|
return self.finalize(state, result)
|
|
|
|
def prepare(self, request):
|
|
"""Lifecycle stage 1: prepare request. Pass-through in M11."""
|
|
return request
|
|
|
|
def execute(self, state):
|
|
"""Lifecycle stage 2: run processing. Delegates to process_images_inner."""
|
|
from modules.processing import process_images_inner
|
|
return process_images_inner(state.processing)
|
|
|
|
def finalize(self, state, result):
|
|
"""Lifecycle stage 3: finalize. Pass-through in M11."""
|
|
return result
|