diff --git a/Containerfile.debugpy b/Containerfile.debugpy index 99c20a9fe..8b83b0050 100644 --- a/Containerfile.debugpy +++ b/Containerfile.debugpy @@ -50,8 +50,6 @@ ENV PLUGIN_API=True ENV EMAIL_ENABLED=True ENV XDMOD_API_URL="localhost" ENV SLURMREST_CLUSTERS="UniversityHPC" -ENV SLURM_UNIVERSITYHPC_ENDPOINT="localhost" -ENV SLURM_UNIVERSITYHPC_TOKEN="dummy" EXPOSE 8000 EXPOSE 5678 diff --git a/coldfront/config/plugins/slurmrest.py b/coldfront/config/plugins/slurmrest.py index fe10badf3..14c1ab2e9 100644 --- a/coldfront/config/plugins/slurmrest.py +++ b/coldfront/config/plugins/slurmrest.py @@ -1,9 +1,10 @@ +import logging import sys from coldfront.config.base import INSTALLED_APPS from coldfront.config.env import ENV # noqa: F401 -from coldfront.config.logging import LOGGING +logger = logging.getLogger(__name__) if "coldfront_plugin_slurmrest" not in INSTALLED_APPS: INSTALLED_APPS += [ @@ -22,11 +23,23 @@ SLURMREST_CLUSTERS = {} for cluster in filter(None, ENV.str("SLURMREST_CLUSTERS", "").split(",")): cluster_name = f"SLURM_{cluster.upper()}" - if (ENV.str(f"{cluster_name}_ENDPOINT") is None) or (ENV.str(f"{cluster_name}_TOKEN") is None): - sys.exit(1) + endpoint = ENV.str(f"{cluster_name}_ENDPOINT", default=None) + token = ENV.str(f"{cluster_name}_TOKEN", default=None) + if endpoint is None or token is None: + # this is an informational logging entry, but since this occurs + # before the log handlers are configured, it needs to be at the + # warn level for the output to be visible in the build logs + logger.warn( + "Configuring slurmrest cluster %r: %s and %s missing, adding dummy values", + cluster, + f"{cluster_name}_ENDPOINT", + f"{cluster_name}_TOKEN", + ) + endpoint = "dummy" + token = "dummy" SLURMREST_CLUSTERS[cluster] = { "name": cluster, - "base_url": ENV.str(f"{cluster_name}_ENDPOINT"), - "token": ENV.str(f"{cluster_name}_TOKEN"), + "base_url": endpoint, + "token": token, } diff --git a/uv.lock b/uv.lock index eb93affa6..f7f928cc2 100644 --- a/uv.lock +++ b/uv.lock @@ -316,7 +316,7 @@ dev = [ [[package]] name = "coldfront-plugin-slurmrest" version = "0.0.1" -source = { git = "https://github.com/NYU-RTS/rts-coldfront-slurm-plugin#74f4ee9e5cc193155aed35ef0d0b2f9dc2ec71ef" } +source = { git = "https://github.com/NYU-RTS/rts-coldfront-slurm-plugin#ff1de657bc9c1faee29e68fb24478ca798b02cfe" } dependencies = [ { name = "coldfront" }, { name = "slurmrest-python" },