Add DEFAULT_AUGUR_RECURSION_LIMIT=10000 by joverlee521 · Pull Request #1200 · nextstrain/augur (original) (raw)
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's a small thing, but I think important to test the value of the env var, e.g. as if recursion_limit did.
AUGUR_RECURSION_LIMIT may be (intentionally or unintentionally) defined in the environment but have no value (e.g. be the empty string). We wouldn't want to call int(''). With .get("AUGUR_RECURSION_LIMIT", DEFAULT_AUGUR_RECURSION_LIMIT), keeping the if recursion_limit would let someone intentionally suppress the default (i.e. use Python's default). This is of dubious utility, though, so I'd probably roll the default and the value test into one thing instead, something like:
DEFAULT_AUGUR_RECURSION_LIMIT = 10000
sys.setrecursionlimit(int(os.environ.get("AUGUR_RECURSION_LIMIT") or DEFAULT_AUGUR_RECURSION_LIMIT))