Merge "Add step info and timestamp to get actions command"
This commit is contained in:
commit
a4474f7bc2
|
@ -122,20 +122,43 @@ def gen_action_table(action_list):
|
||||||
'action_lifecycle'
|
'action_lifecycle'
|
||||||
"""
|
"""
|
||||||
actions = format_utils.table_factory(
|
actions = format_utils.table_factory(
|
||||||
field_names=['Name', 'Action', 'Lifecycle'])
|
field_names=['Name', 'Action', 'Lifecycle', 'Execution Time',
|
||||||
|
'Step Succ/Fail/Oth'])
|
||||||
if action_list:
|
if action_list:
|
||||||
# sort by id, which is ULID - chronological.
|
# sort by id, which is ULID - chronological.
|
||||||
for action in sorted(action_list, key=lambda k: k['id']):
|
for action in sorted(action_list, key=lambda k: k['id']):
|
||||||
actions.add_row([
|
actions.add_row([
|
||||||
action.get('name'), 'action/{}'.format(action.get('id')),
|
action.get('name'),
|
||||||
action.get('action_lifecycle')
|
'action/{}'.format(action.get('id')),
|
||||||
|
action.get('action_lifecycle'),
|
||||||
|
action.get('dag_execution_date'),
|
||||||
|
_step_summary(action.get('steps', []))
|
||||||
])
|
])
|
||||||
else:
|
else:
|
||||||
actions.add_row(['None', '', ''])
|
actions.add_row(['None', '', '', '', ''])
|
||||||
|
|
||||||
return format_utils.table_get_string(actions)
|
return format_utils.table_get_string(actions)
|
||||||
|
|
||||||
|
|
||||||
|
def _step_summary(step_list):
|
||||||
|
"""Creates a single string representation of the step status
|
||||||
|
|
||||||
|
Success/Failed/Other counts in each position
|
||||||
|
"""
|
||||||
|
successes = 0
|
||||||
|
failures = 0
|
||||||
|
other = 0
|
||||||
|
for s in step_list:
|
||||||
|
state = s.get('state')
|
||||||
|
if state in ['success']:
|
||||||
|
successes += 1
|
||||||
|
elif state in ['failed']:
|
||||||
|
failures += 1
|
||||||
|
else:
|
||||||
|
other += 1
|
||||||
|
return "{}/{}/{}".format(successes, failures, other)
|
||||||
|
|
||||||
|
|
||||||
def gen_collection_table(collection_list):
|
def gen_collection_table(collection_list):
|
||||||
"""Generates a list of collections and their status
|
"""Generates a list of collections and their status
|
||||||
|
|
||||||
|
|
|
@ -55,6 +55,7 @@ def test_create_action(*args):
|
||||||
assert 'Lifecycle' in response
|
assert 'Lifecycle' in response
|
||||||
assert 'action/01BTTMFVDKZFRJM80FGD7J1AKN' in response
|
assert 'action/01BTTMFVDKZFRJM80FGD7J1AKN' in response
|
||||||
assert 'Error:' not in response
|
assert 'Error:' not in response
|
||||||
|
assert '0/0/0' in response
|
||||||
|
|
||||||
|
|
||||||
@responses.activate
|
@responses.activate
|
||||||
|
|
|
@ -77,6 +77,7 @@ def test_get_actions(*args):
|
||||||
assert 'deploy_site' in response
|
assert 'deploy_site' in response
|
||||||
assert 'action/01BTP9T2WCE1PAJR2DWYXG805V' in response
|
assert 'action/01BTP9T2WCE1PAJR2DWYXG805V' in response
|
||||||
assert 'Lifecycle' in response
|
assert 'Lifecycle' in response
|
||||||
|
assert '2/1/0' in response
|
||||||
|
|
||||||
|
|
||||||
@responses.activate
|
@responses.activate
|
||||||
|
|
Loading…
Reference in New Issue