Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
o-smirnov committed Nov 18, 2021
1 parent 13cc051 commit 6d0232c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
1 change: 1 addition & 0 deletions iglesia/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@ def get_carta_url(*args):

if CARTA_VERSION < "2":
args = [f"socketUrl=ws://localhost:{CARTA_WS_PORT}"] + args
args += [f"token={uuid.UUID(SESSION_ID)}"]

if args:
return f"{url}?{'&'.join(args)}"
Expand Down
11 changes: 8 additions & 3 deletions iglesia/helpers.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import os, sys, subprocess, atexit, traceback, getpass, tempfile, psutil, stat
import os, sys, subprocess, atexit, traceback, getpass, tempfile, psutil, stat, uuid
from radiopadre_client.config import RADIOPADRE_VENV

import iglesia
Expand All @@ -13,6 +13,7 @@

NUM_PORTS = 6


def init_helpers(radiopadre_base, verbose=False, run_http=True, interactive=True, certificate=None):
"""Starts up helper processes, if they are not already running"""
# set ports, else allocate ports
Expand Down Expand Up @@ -171,12 +172,16 @@ def init_helpers(radiopadre_base, verbose=False, run_http=True, interactive=True

carta_dir = os.environ.get('RADIOPADRE_CARTA_DIR') or os.path.dirname(os.path.dirname(carta_exec))
message(f"Running CARTA {iglesia.CARTA_VERSION} backend {carta_exec} (in dir {carta_dir})")
carta_env = None

if iglesia.CARTA_VERSION >= "2":
carta_dir = iglesia.ABSROOTDIR
cmdline = [carta_exec, f"--port={carta_port}", "--no_browser", "--debug_no_auth",
cmdline = [carta_exec, f"--port={carta_port}", "--no_browser", # "--debug_no_auth",
f"--top_level_folder={iglesia.ABSROOTDIR}", f"--frontend_folder=/usr/share/carta/frontend" ]
carta_stdout, carta_stderr = sys.stdout, sys.stderr
# use our session ID as the auth token for CARTA
carta_env = os.environ.copy()
carta_env['CARTA_AUTH_TOKEN'] = str(uuid.UUID(session_id))
else:
cmdline = [carta_exec, "--remote",
f"--root={iglesia.ABSROOTDIR}", f"--folder={iglesia.ABSROOTDIR}",
Expand All @@ -185,7 +190,7 @@ def init_helpers(radiopadre_base, verbose=False, run_http=True, interactive=True

message(f"$ {' '.join(cmdline)}")
with chdir(carta_dir):
_child_processes.append(subprocess.Popen(cmdline, stdin=subprocess.PIPE, stdout=carta_stdout, stderr=carta_stderr, shell=False))
_child_processes.append(subprocess.Popen(cmdline, stdin=subprocess.PIPE, stdout=carta_stdout, stderr=carta_stderr, shell=False, env=carta_env))
os.environ['RADIOPADRE_CARTA_PID'] = str(_child_processes[-1].pid)
## doesn't exit cleanly, let it be eaten rather
# atexit.register(_exit_carta, _child_processes[-1])
Expand Down

0 comments on commit 6d0232c

Please sign in to comment.