From 6497f49af3d6610c99545c572609ccaddfa9eefa Mon Sep 17 00:00:00 2001 From: Paul Farault Date: Wed, 8 Nov 2023 14:45:34 +0100 Subject: [PATCH] fix: save state in the database after each operation execution --- tdp/cli/commands/deploy.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tdp/cli/commands/deploy.py b/tdp/cli/commands/deploy.py index c8864474..876d7d9b 100644 --- a/tdp/cli/commands/deploy.py +++ b/tdp/cli/commands/deploy.py @@ -93,11 +93,13 @@ def deploy( pass return + # deployment and operations records are mutated by the iterator so we need to + # commit them before iterating and at each iteration session.commit() # Update deployment status to RUNNING for cluster_status_logs in deployment_iterator: if cluster_status_logs and any(cluster_status_logs): session.add_all(cluster_status_logs) - session.commit() + session.commit() if deployment_iterator.deployment.status != DeploymentStateEnum.SUCCESS: raise click.ClickException("Deployment failed.")