diff --git a/apps/cli/executables/pexable/carta_envoy/carta_envoy/launchers.py b/apps/cli/executables/pexable/carta_envoy/carta_envoy/launchers.py index 569345fb43f9dae20cb521b8e1211edf435c64b5..abfba6476e142717cec5d5870353181325e9bb10 100644 --- a/apps/cli/executables/pexable/carta_envoy/carta_envoy/launchers.py +++ b/apps/cli/executables/pexable/carta_envoy/carta_envoy/launchers.py @@ -22,6 +22,7 @@ import os import signal import subprocess import sys +import time from http.server import HTTPServer, SimpleHTTPRequestHandler from pathlib import Path from threading import Thread @@ -185,6 +186,15 @@ class CartaLauncher: f"{file_browser_path!s}", ] try: + # finish setup for CARTA and ensure completion before launch + CartaWrapperLauncher.deploy_wrapper_html(file_browser_path, carta_url, session_timeout_date) + # BIG NASTY COMMENT OF DOOM!!!!! + # DO NOT REMOVE!! + # This is required to ensure that proxy url setup is complete *before* CARTA launches. + # Without this, users are presented with a 404 page on launch as of CARTA3 + time.sleep(2) + + # start CARTA CARTA_PROCESS = subprocess.Popen( carta_command, preexec_fn=os.setpgrp(), @@ -196,8 +206,6 @@ class CartaLauncher: self.teardown() sys.exit(f"ERROR: Failed to launch CARTA: {err}") else: - CartaWrapperLauncher.deploy_wrapper_html(file_browser_path, carta_url, session_timeout_date) - # CARTA is running and accessible, so send CARTA URL to AAT system or notify user self.notify_ready(wrapper_url)