mirror of
https://github.com/langgenius/dify.git
synced 2026-02-13 16:00:55 -05:00
- Moved sandbox-related classes and functions into a dedicated module for better organization. - Updated the sandbox initialization process to streamline asset management and environment setup. - Removed deprecated constants and refactored related code to utilize new sandbox entities. - Enhanced the workflow context to support sandbox integration, allowing for improved state management during execution. - Adjusted various components to utilize the new sandbox structure, ensuring compatibility across the application.
23 lines
582 B
Python
23 lines
582 B
Python
import logging
|
|
|
|
from core.sandbox import Sandbox
|
|
from core.workflow.graph_engine.layers.base import GraphEngineLayer
|
|
from core.workflow.graph_events.base import GraphEngineEvent
|
|
|
|
logger = logging.getLogger(__name__)
|
|
|
|
|
|
class SandboxLayer(GraphEngineLayer):
|
|
def __init__(self, sandbox: Sandbox) -> None:
|
|
super().__init__()
|
|
self._sandbox = sandbox
|
|
|
|
def on_graph_start(self) -> None:
|
|
pass
|
|
|
|
def on_event(self, event: GraphEngineEvent) -> None:
|
|
pass
|
|
|
|
def on_graph_end(self, error: Exception | None) -> None:
|
|
self._sandbox.release()
|