Skip to content
Snippets Groups Projects
Commit 461ddc2f authored by Janet Goldstein's avatar Janet Goldstein
Browse files

WS-649: infrastructure for sending CARTA event info to Workspaces system

parent b58f211c
No related branches found
No related tags found
1 merge request!502WS-649: send CARTA URL to workspaces system
......@@ -50,9 +50,7 @@ class RedisConnect:
front_end_id = self.generated_ids["front_end_id"]
back_end_id = self.generated_ids["back_end_id"]
proxy = self.settings["reverse_proxy"]
carta_url = (
f"https://{proxy}/{front_end_id}/?socketUrl=wss://{proxy}/{back_end_id}/"
)
carta_url = f"https://{proxy}/{front_end_id}/?socketUrl=wss://{proxy}/{back_end_id}/"
if self.settings["single_image"]:
carta_url = carta_url + "&file=" + self.settings["image_name"]
......@@ -181,21 +179,15 @@ class RedisConnect:
f"traefik/http/routers/{carta_wrapper}/middlewares/0": "stripPrefixFE@file",
}
unique_values = self.check_for_duplicate_values(
values, front_end_port, back_end_port, wrapper_port
)
unique_values = self.check_for_duplicate_values(values, front_end_port, back_end_port, wrapper_port)
self.redis_values = unique_values
return unique_values
def check_for_duplicate_values(
self, redis_values: dict, front_port: int, back_port: int, wrapper_port: int
):
def check_for_duplicate_values(self, redis_values: dict, front_port: int, back_port: int, wrapper_port: int):
self.logger.info("Checking for duplicate values on server...")
for key in redis_values:
if self.conn.get(key):
self.logger.warning(
"WARNING: Redis value collision found. Generating new random IDs."
)
self.logger.warning("WARNING: Redis value collision found. Generating new random IDs.")
self.generated_ids = self.generate_ids()
new_values = self.get_redis_values(
self.settings["reverse_proxy"],
......@@ -217,9 +209,7 @@ class RedisConnect:
:param redis_values: Dictionary of Redis entries
:param timeout_minutes: Timeout of the valet in minutes
"""
self.logger.info(
f"Setting Redis values with a timeout of {timeout_minutes} minutes..."
)
self.logger.info(f"Setting Redis values with a timeout of {timeout_minutes} minutes...")
for key, val in redis_values.items():
self.conn.setex(key, 60 * timeout_minutes + 60, val)
......@@ -272,9 +262,7 @@ class NotificationConnect:
self.logger.info("Not sending notification because no user email supplied")
return
self.logger.info(
f"Sending session ready notification with CARTA wrapper URL {wrapper_url}"
)
self.logger.info(f"Sending session ready notification with CARTA wrapper URL {wrapper_url}")
requests.post(
f"{self.url}/notify/carta_ready/send",
json={
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment