mirror of
https://github.com/langgenius/dify.git
synced 2026-04-05 09:49:25 +08:00
test: unit test cases for sub modules in core.app (except core.app.apps) (#32476)
This commit is contained in:
@@ -6,16 +6,23 @@ from dify_graph.graph_events.graph import GraphRunPausedEvent
|
||||
class SuspendLayer(GraphEngineLayer):
|
||||
""" """
|
||||
|
||||
def __init__(self) -> None:
|
||||
super().__init__()
|
||||
self._paused = False
|
||||
|
||||
def on_graph_start(self):
|
||||
pass
|
||||
self._paused = False
|
||||
|
||||
def on_event(self, event: GraphEngineEvent):
|
||||
"""
|
||||
Handle the paused event, stash runtime state into storage and wait for resume.
|
||||
"""
|
||||
if isinstance(event, GraphRunPausedEvent):
|
||||
pass
|
||||
self._paused = True
|
||||
|
||||
def on_graph_end(self, error: Exception | None):
|
||||
""" """
|
||||
pass
|
||||
self._paused = False
|
||||
|
||||
def is_paused(self) -> bool:
|
||||
return self._paused
|
||||
|
||||
@@ -128,14 +128,14 @@ class WorkflowPersistenceLayer(GraphEngineLayer):
|
||||
self._handle_graph_run_paused(event)
|
||||
return
|
||||
|
||||
if isinstance(event, NodeRunStartedEvent):
|
||||
self._handle_node_started(event)
|
||||
return
|
||||
|
||||
if isinstance(event, NodeRunRetryEvent):
|
||||
self._handle_node_retry(event)
|
||||
return
|
||||
|
||||
if isinstance(event, NodeRunStartedEvent):
|
||||
self._handle_node_started(event)
|
||||
return
|
||||
|
||||
if isinstance(event, NodeRunSucceededEvent):
|
||||
self._handle_node_succeeded(event)
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user