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
2 parents 6d0232c + 50cfc2d commit efa99da
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 8 deletions.
2 changes: 1 addition & 1 deletion bin/run-radiopadre
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ import signal
signal.signal(signal.SIGHUP, _handle_hup)

# work out browser
if config.BROWSER.upper() in ("NONE", "FALSE", "0"):
if str(config.BROWSER).upper() in ("NONE", "FALSE", "0"):
config.BROWSER = None


Expand Down
2 changes: 1 addition & 1 deletion iglesia/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ def get_carta_url(*args):
url = f"http://localhost:{CARTA_PORT}"

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

if args:
Expand Down
7 changes: 5 additions & 2 deletions iglesia/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,13 @@ def bye(x, code=1):
message(x, level=logging.ERROR)
sys.exit(code)

def shell(cmd, ignore_fail=False):
def shell(cmd, ignore_fail=False, env=None):
"""Runs shell command. If ignore_fail is set, returns None on failure"""
if env is not None:
env = dict(**env)
env.update(os.environ)
try:
return subprocess.check_call(cmd, shell=True)
return subprocess.check_call(cmd, shell=True, env=env)
except subprocess.CalledProcessError as exc:
if ignore_fail:
return None
Expand Down
7 changes: 6 additions & 1 deletion radiopadre_client/backends/venv.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,14 @@ def update_installation():
else:
bye("no radiopadre installation method specified (see --server-install options)")

if config.VENV_IGNORE_JS9:
env = dict(RADIOPADRE_JS9_IGNORE_ERRORS='1')
else:
env = None

cmd = f"{pip_install} -U {install}"
message(f"Running {cmd}")
shell(cmd)
shell(cmd, env=env)

# if not config.INSIDE_CONTAINER_PORTS:
# message(f" Radiopadre has been installed from {config.SERVER_INSTALL_PATH}")
Expand Down
9 changes: 6 additions & 3 deletions radiopadre_client/remote.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,10 +223,11 @@ def check_remote_command(command):
if not check_remote_file(f"{config.RADIOPADRE_VENV}/bin/activate", "-f"):
message(f"Creating virtualenv {remote_venv}")
ssh_remote_v(f"virtualenv -p python3 {config.RADIOPADRE_VENV}")
extras = "pip setuptools"
if config.VENV_EXTRAS:
extras = " ".join(config.VENV_EXTRAS.split(","))
message(f"Installing specified extras: {extras}")
ssh_remote_v(f"source {config.RADIOPADRE_VENV}/bin/activate && {pip_install} {extras}")
extras += " ".join(config.VENV_EXTRAS.split(","))
message(f"Installing {extras}")
ssh_remote_v(f"source {config.RADIOPADRE_VENV}/bin/activate && {pip_install} -U {extras}")
else:
message(f"Installing into existing virtualenv {remote_venv}")

Expand Down Expand Up @@ -314,6 +315,7 @@ def check_remote_command(command):
for _ in range(NUM_PORTS):
starting_port = find_unused_port(starting_port + 1, 10000)
ports.append(starting_port)
iglesia.set_userside_ports(ports)

remote_config["remote"] = ":".join(map(str, ports))

Expand Down Expand Up @@ -422,6 +424,7 @@ def check_remote_command(command):
iglesia.CARTA_VERSION = match.group(1)
if config.CARTA_BROWSER:
urls.append(iglesia.get_carta_url())
message(f"Remote CARTA version is {iglesia.CARTA_VERSION} ({config.CARTA_BROWSER})")
continue

if "jupyter notebook server is running" in line:
Expand Down

0 comments on commit efa99da

Please sign in to comment.