diff options
author | tmartins <thigm85@gmail.com> | 2020-08-20 13:37:13 +0200 |
---|---|---|
committer | tmartins <thigm85@gmail.com> | 2020-08-20 13:37:13 +0200 |
commit | 3f6fcaefe320aa5f6207f87ea5b5c538c2304686 (patch) | |
tree | 436af88a9a81612ef027eb1a09c3d194f5aef82c /python | |
parent | c5b2d82bb3d8612f7a3df85ff6b61b8200099b47 (diff) |
raise exception when deployment fails or return Vespa with deployment message when deployment succeeds.
Diffstat (limited to 'python')
-rw-r--r-- | python/vespa/vespa/package.py | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/python/vespa/vespa/package.py b/python/vespa/vespa/package.py index ca6491fdc62..a9d589e46d1 100644 --- a/python/vespa/vespa/package.py +++ b/python/vespa/vespa/package.py @@ -1,4 +1,5 @@ import os +import re from time import sleep from typing import List, Mapping, Optional from pathlib import Path @@ -440,8 +441,7 @@ class VespaDocker(object): :param disk_folder: Disk folder to save the required Vespa config files. :param container_memory: Docker container memory available to the application. - :return: A tuple where the first element is the deployment message and the second element is a Vespa connection - instance. + :return: a Vespa connection instance. """ self.application_package.create_application_package_files(dir_path=disk_folder) @@ -458,7 +458,11 @@ class VespaDocker(object): "bash -c '/opt/vespa/bin/vespa-deploy prepare /app/application && /opt/vespa/bin/vespa-deploy activate'" ) - return ( - deployment.output.decode("utf-8").split("\n"), - Vespa(url="http://localhost", port=8080), + deployment_message = deployment.output.decode("utf-8").split("\n") + + if not any(re.match("Generation: [0-9]+", line) for line in deployment_message): + raise RuntimeError(deployment_message) + + return Vespa( + url="http://localhost", port=8080, deployment_message=deployment_message ) |