Set empty list of tasks by default
If a graph does not assume running any tasks on some nodes, these nodes will hang on 1% progress forever because astute just knows nothing about these nodes and thus is unable to send any report about these nodes. Change-Id: Id8f2f8112720180e13193d70b47c88c3106ffe6f Closes-Bug: #1666192
This commit is contained in:
parent
1ebd029b5e
commit
e4290053d9
|
@ -52,7 +52,7 @@ class TestMakeAstuteMessage(BaseUnitTest):
|
||||||
lcm_mock.TransactionSerializer.serialize.return_value = (
|
lcm_mock.TransactionSerializer.serialize.return_value = (
|
||||||
tasks_directory, tasks_graph, {}
|
tasks_directory, tasks_graph, {}
|
||||||
)
|
)
|
||||||
result = manager.make_astute_message(tx, context, graph, resolver)
|
result = manager.make_astute_message(tx, context, graph, resolver, [])
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
{
|
{
|
||||||
'api_version': manager.settings.VERSION['api'],
|
'api_version': manager.settings.VERSION['api'],
|
||||||
|
|
|
@ -57,7 +57,7 @@ def _get_node_attributes(graph, kind):
|
||||||
return r
|
return r
|
||||||
|
|
||||||
|
|
||||||
def make_astute_message(transaction, context, graph, node_resolver):
|
def make_astute_message(transaction, context, graph, node_resolver, all_nodes):
|
||||||
directory, tasks, metadata = lcm.TransactionSerializer.serialize(
|
directory, tasks, metadata = lcm.TransactionSerializer.serialize(
|
||||||
context, graph['tasks'], node_resolver
|
context, graph['tasks'], node_resolver
|
||||||
)
|
)
|
||||||
|
@ -72,6 +72,9 @@ def make_astute_message(transaction, context, graph, node_resolver):
|
||||||
metadata['subgraphs'] = subgraphs
|
metadata['subgraphs'] = subgraphs
|
||||||
objects.DeploymentHistoryCollection.create(transaction, tasks)
|
objects.DeploymentHistoryCollection.create(transaction, tasks)
|
||||||
|
|
||||||
|
for node in all_nodes:
|
||||||
|
tasks.setdefault(str(node.uid), [])
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'api_version': settings.VERSION['api'],
|
'api_version': settings.VERSION['api'],
|
||||||
'method': 'task_deploy',
|
'method': 'task_deploy',
|
||||||
|
@ -352,7 +355,7 @@ class TransactionsManager(object):
|
||||||
)
|
)
|
||||||
for node in nodes:
|
for node in nodes:
|
||||||
# set progress to show that node is in progress state
|
# set progress to show that node is in progress state
|
||||||
node.progress = 1
|
node.progress = 0
|
||||||
if not sub_transaction.dry_run:
|
if not sub_transaction.dry_run:
|
||||||
node.error_type = None
|
node.error_type = None
|
||||||
node.error_msg = None
|
node.error_msg = None
|
||||||
|
@ -380,7 +383,7 @@ class TransactionsManager(object):
|
||||||
_dump_expected_state(sub_transaction, context.new, graph['tasks'])
|
_dump_expected_state(sub_transaction, context.new, graph['tasks'])
|
||||||
|
|
||||||
message = make_astute_message(
|
message = make_astute_message(
|
||||||
sub_transaction, context, graph, resolver
|
sub_transaction, context, graph, resolver, nodes
|
||||||
)
|
)
|
||||||
objects.Transaction.on_start(sub_transaction)
|
objects.Transaction.on_start(sub_transaction)
|
||||||
helpers.TaskHelper.create_action_log(sub_transaction)
|
helpers.TaskHelper.create_action_log(sub_transaction)
|
||||||
|
|
Loading…
Reference in New Issue