Merge "Make workflow monitoring more resilient"

This commit is contained in:
Zuul 2021-01-12 09:29:18 +00:00 committed by Gerrit Code Review
commit 143666443c

View File

@ -10,6 +10,7 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
import json import json
import keystoneauth1
import logging import logging
from tripleoclient import exceptions from tripleoclient import exceptions
@ -78,7 +79,13 @@ def wait_for_messages(mistral, websocket, execution, timeout=None):
# Workflows should end with SUCCESS or ERROR statuses. # Workflows should end with SUCCESS or ERROR statuses.
if payload.get('status', 'RUNNING') != "RUNNING": if payload.get('status', 'RUNNING') != "RUNNING":
return return
try:
execution = mistral.executions.get(execution.id) execution = mistral.executions.get(execution.id)
except keystoneauth1.exceptions.connection.ConnectFailure as e:
LOG.warning("Connection failure while fetching execution ID."
"Retrying: %s" % e)
continue
if execution.state != "RUNNING": if execution.state != "RUNNING":
# yield the output as the last payload which was missed # yield the output as the last payload which was missed
yield json.loads(execution.output) yield json.loads(execution.output)