From 94e307c6970b3003f7cef64a42895eaa22bf2494 Mon Sep 17 00:00:00 2001 From: "Christian R. Garcia" Date: Fri, 1 Dec 2023 16:22:19 -0800 Subject: [PATCH 1/2] Harden `t` init as networking issues can slow or break the ability to initialize said `t`. --- actors/__init__.py | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/actors/__init__.py b/actors/__init__.py index 05b32a5a..95e89832 100644 --- a/actors/__init__.py +++ b/actors/__init__.py @@ -1,4 +1,5 @@ import os +import time # Initialize as normal if this module is NOT called from a test container. # This allows us to not use flaskbase when calling codes.py @@ -11,8 +12,14 @@ logger = get_logger(__name__) Tenants = TenantCache() - try: - t = get_service_tapis_client(tenants=Tenants) - except Exception as e: - logger.error(f'Could not instantiate tapy service client. Exception: {e}') - raise e \ No newline at end of file + for _ in range(5): + try: + t = get_service_tapis_client(tenants=Tenants) + break # Exit the loop if t is successfully created + except Exception as e: + logger.error(f'Could not instantiate tapy service client. Exception: {e}') + time.sleep(2) # Delay for 2 seconds before the next attempt + else: + msg = 'Failed to create tapy service client after 10 attempts, networking?' + logger.error(msg) + raise RuntimeError(msg) \ No newline at end of file From f2034c81a02d675d9a6a70752ff9a0c904f4ba19 Mon Sep 17 00:00:00 2001 From: "Christian R. Garcia" Date: Wed, 3 Jan 2024 10:37:36 -0800 Subject: [PATCH 2/2] Update so -v3 isn't included in tags (ex. :dev-v3) --- .github/workflows/build-push-all-branches.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-push-all-branches.yml b/.github/workflows/build-push-all-branches.yml index 17d5e25a..772012ed 100644 --- a/.github/workflows/build-push-all-branches.yml +++ b/.github/workflows/build-push-all-branches.yml @@ -28,7 +28,7 @@ jobs: - name: Get tag name from branch. SED removes `v3-release-`; replaces `prod-v3` with `staging`. id: get_tag_name shell: bash - run: echo "tag_name=$(echo ${GITHUB_REF#refs/heads/} | sed 's/prod-v3/staging/g' | sed 's/v3-release-//g')" >> $GITHUB_OUTPUT + run: echo "tag_name=$(echo ${GITHUB_REF#refs/heads/} | sed 's/prod-v3/staging/g' | sed 's/v3-release-//g' | sed 's/-v3//g')" >> $GITHUB_OUTPUT - name: Checkout repo uses: actions/checkout@v3