Merge "Add 'runtime_context' to task execution REST resource"

This commit is contained in:
Jenkins 2017-05-22 15:00:19 +00:00 committed by Gerrit Code Review
commit d71b48d40a
2 changed files with 21 additions and 2 deletions

View File

@ -297,6 +297,8 @@ class Task(resource.Resource):
state_info = wtypes.text
"an optional state information string"
runtime_context = types.jsontype
result = wtypes.text
published = types.jsontype
processed = bool
@ -318,6 +320,14 @@ class Task(resource.Resource):
workflow_execution_id='123e4567-e89b-12d3-a456-426655440000',
name='task',
state=states.SUCCESS,
runtime_context={
'triggered_by': [
{
'task_id': '123-123-123',
'event': 'on-success'
}
]
},
result='task result',
published={'key': 'value'},
processed=True,

View File

@ -30,6 +30,14 @@ from mistral.workflow import states
RESULT = {"some": "result"}
PUBLISHED = {"var": "val"}
RUNTIME_CONTEXT = {
'triggered_by': [
{
'task_id': '123-123-123',
'event': 'on-success'
}
]
}
WF_EX = models.WorkflowExecution(
id='abc',
@ -59,7 +67,7 @@ TASK_EX = models.TaskExecution(
state=states.RUNNING,
tags=['a', 'b'],
in_context={},
runtime_context={},
runtime_context=RUNTIME_CONTEXT,
workflow_execution_id=WF_EX.id,
created_at=datetime.datetime(1970, 1, 1),
updated_at=datetime.datetime(1970, 1, 1),
@ -82,7 +90,7 @@ WITH_ITEMS_TASK_EX = models.TaskExecution(
state=states.RUNNING,
tags=['a', 'b'],
in_context={},
runtime_context={},
runtime_context=RUNTIME_CONTEXT,
workflow_execution_id=WF_EX.id,
created_at=datetime.datetime(1970, 1, 1),
updated_at=datetime.datetime(1970, 1, 1),
@ -101,6 +109,7 @@ TASK = {
'updated_at': '1970-01-01 00:00:00',
'result': json.dumps(RESULT),
'published': json.dumps(PUBLISHED),
'runtime_context': json.dumps(RUNTIME_CONTEXT),
'processed': True
}