From ec9156dfbc3b5a2d48426b8075780f0073fdf3ff Mon Sep 17 00:00:00 2001 From: Antonio Paiva <47902248+arpaiva@users.noreply.github.com> Date: Fri, 28 Jul 2023 09:04:27 -0400 Subject: [PATCH 1/3] Make logging output dir user-specific --- mlxu/logging.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/mlxu/logging.py b/mlxu/logging.py index c677013..f600b4b 100644 --- a/mlxu/logging.py +++ b/mlxu/logging.py @@ -1,5 +1,6 @@ import os import random +import string import tempfile import time import uuid @@ -20,11 +21,15 @@ class WandBLogger(object): @staticmethod def get_default_config(updates=None): + # grab username and perform filtering to prevent code injection + username = os.environ["USER"] + username = [c if c in string.ascii_letters + string.digits + "_-"][:32] + config = config_dict() config.online = False config.prefix = "" config.project = "mlxu" - config.output_dir = "/tmp/mlxu" + config.output_dir = f"/tmp/mlxu-{username}" config.wandb_dir = "" config.random_delay = 0.0 config.experiment_id = config_placeholder(str) From e466dde6e6d5a63b5df240978e6cd0fdaa85d159 Mon Sep 17 00:00:00 2001 From: Antonio Paiva <47902248+arpaiva@users.noreply.github.com> Date: Fri, 28 Jul 2023 09:55:53 -0400 Subject: [PATCH 2/3] Fix syntax --- mlxu/logging.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/mlxu/logging.py b/mlxu/logging.py index f600b4b..1b60a7a 100644 --- a/mlxu/logging.py +++ b/mlxu/logging.py @@ -23,7 +23,10 @@ class WandBLogger(object): def get_default_config(updates=None): # grab username and perform filtering to prevent code injection username = os.environ["USER"] - username = [c if c in string.ascii_letters + string.digits + "_-"][:32] + username = [ + c for c in username if c in string.ascii_letters + string.digits + "_-" + ] + username = username[:32] # usernames are limited to 32 characters config = config_dict() config.online = False From 37cd1f322ff85367390d9bc8f70248d896ab8f99 Mon Sep 17 00:00:00 2001 From: Antonio Paiva <47902248+arpaiva@users.noreply.github.com> Date: Fri, 28 Jul 2023 10:05:51 -0400 Subject: [PATCH 3/3] Fix syntax --- mlxu/logging.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mlxu/logging.py b/mlxu/logging.py index 1b60a7a..134e8c4 100644 --- a/mlxu/logging.py +++ b/mlxu/logging.py @@ -26,7 +26,7 @@ def get_default_config(updates=None): username = [ c for c in username if c in string.ascii_letters + string.digits + "_-" ] - username = username[:32] # usernames are limited to 32 characters + username = "".join(username[:32]) # usernames are limited to 32 chars config = config_dict() config.online = False