Update global progress if no progress was sent
At now moment Astute do not send global progress for transaction/deploy tasks. Nailgun should calculate it using nodes progress. This fix add ability to calculate progress in case of transaction same way as for deploy. Change-Id: I2c87b0de0bacb83ef98ff230f8ad0d5f7904becd Closes-Bug: #1645612
This commit is contained in:
parent
188f884d9a
commit
edc19fd0fc
|
@ -644,14 +644,14 @@ def _update_transaction(transaction, status, progress, message):
|
|||
data = {}
|
||||
if status:
|
||||
data['status'] = status
|
||||
if progress:
|
||||
data['progress'] = progress
|
||||
if message:
|
||||
data['message'] = message
|
||||
data['progress'] = _calculate_progress(transaction, progress)
|
||||
if data:
|
||||
objects.Transaction.update(transaction, data)
|
||||
|
||||
if transaction.parent and progress:
|
||||
if transaction.parent and data['progress']:
|
||||
logger.debug("Updating parent task: %s.", transaction.parent.uuid)
|
||||
siblings = transaction.parent.subtasks
|
||||
total_progress = sum(x.progress for x in siblings)
|
||||
objects.Transaction.update(transaction.parent, {
|
||||
|
@ -659,6 +659,14 @@ def _update_transaction(transaction, status, progress, message):
|
|||
})
|
||||
|
||||
|
||||
def _calculate_progress(transaction, progress):
|
||||
if progress is not None:
|
||||
return progress
|
||||
else:
|
||||
return helpers.TaskHelper.recalculate_deployment_task_progress(
|
||||
transaction)
|
||||
|
||||
|
||||
def _update_cluster_status(transaction):
|
||||
if transaction.dry_run:
|
||||
return
|
||||
|
|
Loading…
Reference in New Issue