Include the state message
This commit is contained in:
parent
f49615bfec
commit
3d2ba971f2
|
@ -168,6 +168,7 @@ class WorkflowMetadata(object):
|
|||
category_id=spec.category_id,
|
||||
category_display_name=spec.category.display_name,
|
||||
state=workflow.state or WorkflowState.optional.value,
|
||||
state_message=workflow.state_message,
|
||||
status=workflow.status,
|
||||
total_tasks=workflow.total_tasks,
|
||||
completed_tasks=workflow.completed_tasks,
|
||||
|
|
|
@ -119,3 +119,4 @@ class WorkflowModel(db.Model):
|
|||
last_updated = db.Column(db.DateTime(timezone=True), server_default=func.now())
|
||||
user_id = db.Column(db.String, default=None)
|
||||
state = db.Column(db.String, nullable=True)
|
||||
state_message = db.Column(db.String, nullable=True)
|
||||
|
|
|
@ -1140,11 +1140,13 @@ class WorkflowService(object):
|
|||
# only process the workflows (there are other things in master_workflow_results)
|
||||
if workflow_spec_id in wf_by_workflow_spec_id:
|
||||
workflow_state = master_workflow_results[workflow_spec_id]['status']
|
||||
workflow_state_message = master_workflow_results[workflow_spec_id]['message']
|
||||
# Make sure we have a valid state
|
||||
if WorkflowState.has_value(workflow_state):
|
||||
# Get the workflow from our dictionary and set the state
|
||||
workflow = wf_by_workflow_spec_id[workflow_spec_id]
|
||||
workflow.state = workflow_state
|
||||
workflow.state_message = workflow_state_message
|
||||
session.add(workflow)
|
||||
|
||||
session.commit()
|
||||
|
|
|
@ -18,7 +18,9 @@ depends_on = None
|
|||
|
||||
def upgrade():
|
||||
op.add_column('workflow', sa.Column('state', sa.String(), nullable=True))
|
||||
op.add_column('workflow', sa.Column('state_message', sa.String(), nullable=True))
|
||||
|
||||
|
||||
def downgrade():
|
||||
op.drop_column('workflow', 'state')
|
||||
op.drop_column('workflow', 'state_message')
|
||||
|
|
Loading…
Reference in New Issue