Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
D
dify
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ai-tech
dify
Commits
4f5c052d
Commit
4f5c052d
authored
Mar 12, 2024
by
takatost
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix single step run error
parent
15ddbb5e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
42 additions
and
22 deletions
+42
-22
workflow_service.py
api/services/workflow_service.py
+42
-22
No files found.
api/services/workflow_service.py
View file @
4f5c052d
...
@@ -270,28 +270,48 @@ class WorkflowService:
...
@@ -270,28 +270,48 @@ class WorkflowService:
return
workflow_node_execution
return
workflow_node_execution
# create workflow node execution
if
node_run_result
.
status
==
WorkflowNodeExecutionStatus
.
SUCCEEDED
:
workflow_node_execution
=
WorkflowNodeExecution
(
# create workflow node execution
tenant_id
=
app_model
.
tenant_id
,
workflow_node_execution
=
WorkflowNodeExecution
(
app_id
=
app_model
.
id
,
tenant_id
=
app_model
.
tenant_id
,
workflow_id
=
draft_workflow
.
id
,
app_id
=
app_model
.
id
,
triggered_from
=
WorkflowNodeExecutionTriggeredFrom
.
SINGLE_STEP
.
value
,
workflow_id
=
draft_workflow
.
id
,
index
=
1
,
triggered_from
=
WorkflowNodeExecutionTriggeredFrom
.
SINGLE_STEP
.
value
,
node_id
=
node_id
,
index
=
1
,
node_type
=
node_instance
.
node_type
.
value
,
node_id
=
node_id
,
title
=
node_instance
.
node_data
.
title
,
node_type
=
node_instance
.
node_type
.
value
,
inputs
=
json
.
dumps
(
node_run_result
.
inputs
)
if
node_run_result
.
inputs
else
None
,
title
=
node_instance
.
node_data
.
title
,
process_data
=
json
.
dumps
(
node_run_result
.
process_data
)
if
node_run_result
.
process_data
else
None
,
inputs
=
json
.
dumps
(
node_run_result
.
inputs
)
if
node_run_result
.
inputs
else
None
,
outputs
=
json
.
dumps
(
node_run_result
.
outputs
)
if
node_run_result
.
outputs
else
None
,
process_data
=
json
.
dumps
(
node_run_result
.
process_data
)
if
node_run_result
.
process_data
else
None
,
execution_metadata
=
(
json
.
dumps
(
jsonable_encoder
(
node_run_result
.
metadata
))
outputs
=
json
.
dumps
(
node_run_result
.
outputs
)
if
node_run_result
.
outputs
else
None
,
if
node_run_result
.
metadata
else
None
),
execution_metadata
=
(
json
.
dumps
(
jsonable_encoder
(
node_run_result
.
metadata
))
status
=
WorkflowNodeExecutionStatus
.
SUCCEEDED
.
value
,
if
node_run_result
.
metadata
else
None
),
elapsed_time
=
time
.
perf_counter
()
-
start_at
,
status
=
WorkflowNodeExecutionStatus
.
SUCCEEDED
.
value
,
created_by_role
=
CreatedByRole
.
ACCOUNT
.
value
,
elapsed_time
=
time
.
perf_counter
()
-
start_at
,
created_by
=
account
.
id
,
created_by_role
=
CreatedByRole
.
ACCOUNT
.
value
,
created_at
=
datetime
.
utcnow
(),
created_by
=
account
.
id
,
finished_at
=
datetime
.
utcnow
()
created_at
=
datetime
.
utcnow
(),
)
finished_at
=
datetime
.
utcnow
()
)
else
:
# create workflow node execution
workflow_node_execution
=
WorkflowNodeExecution
(
tenant_id
=
app_model
.
tenant_id
,
app_id
=
app_model
.
id
,
workflow_id
=
draft_workflow
.
id
,
triggered_from
=
WorkflowNodeExecutionTriggeredFrom
.
SINGLE_STEP
.
value
,
index
=
1
,
node_id
=
node_id
,
node_type
=
node_instance
.
node_type
.
value
,
title
=
node_instance
.
node_data
.
title
,
status
=
node_run_result
.
status
.
value
,
error
=
node_run_result
.
error
,
elapsed_time
=
time
.
perf_counter
()
-
start_at
,
created_by_role
=
CreatedByRole
.
ACCOUNT
.
value
,
created_by
=
account
.
id
,
created_at
=
datetime
.
utcnow
(),
finished_at
=
datetime
.
utcnow
()
)
db
.
session
.
add
(
workflow_node_execution
)
db
.
session
.
add
(
workflow_node_execution
)
db
.
session
.
commit
()
db
.
session
.
commit
()
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment