mirror of
https://github.com/1Panel-dev/MaxKB.git
synced 2025-12-26 01:33:05 +00:00
fix: Error in total time consumption statistics for executing records (#4459)
This commit is contained in:
parent
1869b47dde
commit
ff26835c93
|
|
@ -105,8 +105,11 @@ class KnowledgeWorkflowPostHandler(WorkFlowPostHandler):
|
|||
self.knowledge_action_id = knowledge_action_id
|
||||
|
||||
def handler(self, workflow):
|
||||
err = [True for key, value in workflow.get_runtime_details().items() if value.get('status') == 500]
|
||||
QuerySet(KnowledgeAction).filter(id=self.knowledge_action_id).update(
|
||||
state=State.SUCCESS)
|
||||
state=State.FAILURE if any(err) else State.SUCCESS,
|
||||
run_time=time.time() - workflow.context.get('start_time') if workflow.context.get(
|
||||
'start_time') is not None else 0)
|
||||
|
||||
|
||||
class NodeResult:
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@
|
|||
@date:2025/11/13 19:02
|
||||
@desc:
|
||||
"""
|
||||
import time
|
||||
import traceback
|
||||
from concurrent.futures import ThreadPoolExecutor
|
||||
|
||||
|
|
@ -43,6 +44,7 @@ class KnowledgeWorkflowManage(WorkflowManage):
|
|||
return start_node_list[0]
|
||||
|
||||
def run(self):
|
||||
self.context['start_time'] = time.time()
|
||||
executor.submit(self._run)
|
||||
|
||||
def _run(self):
|
||||
|
|
|
|||
Loading…
Reference in New Issue