From 3ff55045ed105262f544ffb11c84b9b2682697ed Mon Sep 17 00:00:00 2001 From: Galen O'Sullivan Date: Thu, 19 Sep 2024 19:03:57 -0700 Subject: [PATCH 1/3] Make core backwards compatible. this way users won't be surprised if the old envvar stops working. --- runpod/serverless/__init__.py | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/runpod/serverless/__init__.py b/runpod/serverless/__init__.py index 7c238150..c43e9561 100644 --- a/runpod/serverless/__init__.py +++ b/runpod/serverless/__init__.py @@ -172,16 +172,16 @@ def start(config: Dict[str, Any]): return # --------------------------------- SLS-Core --------------------------------- # - if os.getenv("RUNPOD_SLS_CORE", "false").lower() in ( - "1", - "t", - "T", - "TRUE", - "true", - "True", - ): - core.main(config) - return + + match os.getenv("RUNPOD_SLS_CORE"): + case None if os.getenv("RUNPOD_USE_CORE") is not None: + log.warn("RUNPOD_USE_CORE is deprecated. Please use RUNPOD_SLS_CORE instead.") + core.main(config) + return + + case x if x.lower() in ["1", "t", "T", "TRUE", "true", "True"]: + core.main(config) + return # --------------------------------- Standard --------------------------------- # worker.main(config) From d9bd8d00af49aae7fa5402f914d7961fa34183dc Mon Sep 17 00:00:00 2001 From: Galen O'Sullivan Date: Thu, 19 Sep 2024 19:27:23 -0700 Subject: [PATCH 2/3] Since we're lowering, don't need to check uppercase. --- runpod/serverless/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runpod/serverless/__init__.py b/runpod/serverless/__init__.py index c43e9561..aa261b79 100644 --- a/runpod/serverless/__init__.py +++ b/runpod/serverless/__init__.py @@ -179,7 +179,7 @@ def start(config: Dict[str, Any]): core.main(config) return - case x if x.lower() in ["1", "t", "T", "TRUE", "true", "True"]: + case x if x.lower() in ["1", "t", "true"]: core.main(config) return From d7999f4b60e7111f9574cc7ca2796d4b9de6c590 Mon Sep 17 00:00:00 2001 From: Galen O'Sullivan Date: Thu, 19 Sep 2024 19:29:49 -0700 Subject: [PATCH 3/3] don't use match syntax --- runpod/serverless/__init__.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/runpod/serverless/__init__.py b/runpod/serverless/__init__.py index aa261b79..62f70722 100644 --- a/runpod/serverless/__init__.py +++ b/runpod/serverless/__init__.py @@ -173,13 +173,12 @@ def start(config: Dict[str, Any]): # --------------------------------- SLS-Core --------------------------------- # - match os.getenv("RUNPOD_SLS_CORE"): - case None if os.getenv("RUNPOD_USE_CORE") is not None: + if os.getenv("RUNPOD_SLS_CORE") is None and os.getenv("RUNPOD_USE_CORE") is not None: log.warn("RUNPOD_USE_CORE is deprecated. Please use RUNPOD_SLS_CORE instead.") core.main(config) return - case x if x.lower() in ["1", "t", "true"]: + elif os.getenv("RUNPOD_SLS_CORE","false").lower() in ["1", "t", "true"]: core.main(config) return