Add 'created_at' and 'updated_at' to task-get command

Change-Id: Iaeaed67c1792a43ee05bb320ebfa6961e3e4987c
This commit is contained in:
Renat Akhmerov 2016-09-12 16:23:51 +03:00
parent 3a8ee95923
commit 492c264526
2 changed files with 14 additions and 4 deletions

View File

@ -38,7 +38,9 @@ def format(task=None, lister=False):
'Workflow name',
'Execution ID',
'State',
'State info'
'State info',
'Created at',
'Updated at'
)
if task:
@ -51,7 +53,9 @@ def format(task=None, lister=False):
task.workflow_name,
task.workflow_execution_id,
task.state,
state_info
state_info,
task.created_at,
task.updated_at or '<none>'
)
else:
data = (tuple('<none>' for _ in range(len(columns))),)
@ -69,6 +73,7 @@ class List(base.MistralLister):
'workflow_execution',
nargs='?',
help='Workflow execution ID associated with list of Tasks.')
return parser
def _get_format_function(self):
@ -76,6 +81,7 @@ class List(base.MistralLister):
def _get_resources(self, parsed_args):
mistral_client = self.app.client_manager.workflow_engine
return mistral_client.tasks.list(parsed_args.workflow_execution)

View File

@ -29,7 +29,9 @@ TASK_DICT = {
'workflow_name': 'thing',
'workflow_execution_id': '321',
'state': 'RUNNING',
'state_info': None
'state_info': None,
'created_at': '1',
'updated_at': '1',
}
TASK_RESULT = {"test": "is", "passed": "successfully"}
@ -44,7 +46,9 @@ TASK = tasks.Task(mock, TASK_DICT)
TASK_WITH_RESULT = tasks.Task(mock, TASK_WITH_RESULT_DICT)
TASK_WITH_PUBLISHED = tasks.Task(mock, TASK_WITH_PUBLISHED_DICT)
EXPECTED_TASK_RESULT = ('123', 'some', 'thing', '321', 'RUNNING', None)
EXPECTED_TASK_RESULT = (
'123', 'some', 'thing', '321', 'RUNNING', None, '1', '1'
)
class TestCLITasksV2(base.BaseCommandTest):