Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add DEFAULT_AUGUR_RECURSION_LIMIT=10000 #1200

Merged
merged 3 commits into from Apr 17, 2023
Merged

Conversation

joverlee521
Copy link
Contributor

@joverlee521 joverlee521 commented Apr 14, 2023

Description of proposed changes

We've had to use the AUGUR_RECURSION_LIMIT environment variable to
bump the recursion limit for SARS-CoV-2 builds¹, mpox builds², and
our nextstrain-jobs definition in AWS Batch. From a general search of
the envvar across GitHub³, 10,000 looks like the default that others use
as well (although this may be influenced by our discussions⁴).

¹ nextstrain/ncov#690
² nextstrain/mpox#150
³ https://cs.github.com/?scopeName=All+repos&scope=&q=AUGUR_RECURSION_LIMIT%3D
#328

Testing

What steps should be taken to test the changes you've proposed?
If you added or changed behavior in the codebase, did you update the tests, or do you need help with this?

Checklist

  • Add a message in CHANGES.md summarizing the changes in this PR that are end user focused. Keep headers and formatting consistent with the rest of the file.

@joverlee521 joverlee521 requested a review from a team April 14, 2023 23:36
@codecov
Copy link

codecov bot commented Apr 14, 2023

Codecov Report

Patch coverage: 100.00% and project coverage change: +0.02 🎉

Comparison is base (40ad169) 68.34% compared to head (fab8c09) 68.37%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1200      +/-   ##
==========================================
+ Coverage   68.34%   68.37%   +0.02%     
==========================================
  Files          64       64              
  Lines        6853     6852       -1     
  Branches     1663     1662       -1     
==========================================
+ Hits         4684     4685       +1     
+ Misses       1858     1857       -1     
+ Partials      311      310       -1     
Impacted Files Coverage Δ
augur/__init__.py 69.81% <100.00%> (+3.14%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@rneher
Copy link
Member

rneher commented Apr 15, 2023

thanks, Jover. This makes sense to me. I think with the upgrade from TreeTime from 0.8.5 to >=0.9 the behavior of the polytomy resolution has changed slightly such that we are now often producing caterpillar like resolutions which leads to many more nesting and thus more recursion in newick output.

@rneher
Copy link
Member

rneher commented Apr 15, 2023

I added the possibility to set the recursion limit in TreeTime a few days ago (and by default set it 10000).
neherlab/treetime@cec7e35

Copy link
Member

@tsibley tsibley left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 for the change. A note on an edge case, though.

Comment on lines 18 to 19
recursion_limit = os.environ.get("AUGUR_RECURSION_LIMIT")
if recursion_limit:
sys.setrecursionlimit(int(recursion_limit))
DEFAULT_AUGUR_RECURSION_LIMIT = 10000
sys.setrecursionlimit(int(os.environ.get("AUGUR_RECURSION_LIMIT", DEFAULT_AUGUR_RECURSION_LIMIT)))
Copy link
Member

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))

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, good catch! Updated to the suggested change in 1834540.

We've had to use the `AUGUR_RECURSION_LIMIT` environment variable to
bump the recursion limit for SARS-CoV-2 builds¹, mpox builds², and
our `nextstrain-jobs` definition in AWS Batch. From a general search of
the envvar across GitHub³, 10,000 looks like the default that others use
as well (although this may be influenced by our discussions⁴).

¹ nextstrain/ncov#690
² nextstrain/mpox#150
³ https://cs.github.com/?scopeName=All+repos&scope=&q=AUGUR_RECURSION_LIMIT%3D#328
@joverlee521 joverlee521 merged commit e6ff9ef into master Apr 17, 2023
15 checks passed
@joverlee521 joverlee521 deleted the default-recursion-limit branch April 17, 2023 20:27
@victorlin
Copy link
Member

Just did some debugging with @miparedes on why an export AUGUR_RECURSION_LIMIT=100000 in the shell was not being respected when running a workflow. @tsibley figured out that the workflow itself is setting AUGUR_RECURSION_LIMIT=10000, which was added in many places before the default was bumped here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

None yet

5 participants