-
Notifications
You must be signed in to change notification settings - Fork 1
increase ulimit for cutadapt
#14
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
base: test-v1.2.0
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -41,6 +41,9 @@ source /scripts/submodules/framework.functions.sh | |||||||||||||||||||||||||||||||||||||||||||||||||||
| #output dir | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| output_dir=$"/input/demultiplex_out" | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
| # Increase the number of open files limit | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| ulimit -S -n 6000 | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+44
to
+46
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
| # Increase the number of open files limit | |
| ulimit -S -n 6000 | |
| # Increase the number of open files limit (respect hard limit and avoid lowering current soft limit) | |
| desired_nofiles=65536 | |
| hard_limit=$(ulimit -H -n 2>/dev/null) | |
| soft_limit=$(ulimit -S -n 2>/dev/null) | |
| # Determine target_limit: do not exceed hard limit (if numeric), and do not go below current soft limit | |
| if [ "$hard_limit" = "unlimited" ] || [ "$hard_limit" = "unlimited\n" ]; then | |
| target_limit=$desired_nofiles | |
| else | |
| target_limit=$desired_nofiles | |
| if [ "$hard_limit" -lt "$desired_nofiles" ] 2>/dev/null; then | |
| target_limit=$hard_limit | |
| fi | |
| fi | |
| # Never lower the existing soft limit | |
| if [ "$soft_limit" -gt "$target_limit" ] 2>/dev/null; then | |
| target_limit=$soft_limit | |
| fi | |
| ulimit -S -n "$target_limit" 2>/dev/null || { | |
| printf 'Warning: unable to increase open file limit; continuing with current limits.\n' >&2 | |
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The command
ulimit -S -n 6000only raises the soft limit for open files. The soft limit can only be raised up to the current hard limit. If the container's hard limit is lower than 6000 (which on some Docker/OS configurations may equal the default of 1024), this command will fail with an error likebash: ulimit: open files: cannot modify limit: Operation not permittedor silently do nothing.To ensure this works reliably across all deployment environments, consider also setting the hard limit (
ulimit -H -n 6000), which requires root/privileged access (common in containers), or — more robustly — setting thenofileulimit at the Docker container creation level inHostConfig.Ulimits. Additionally, if users run large multiplexing experiments (e.g., 96×96 adapters for paired-end), they would need 96×96×2 ≈ 18,432 file descriptors, which would exceed the hardcoded 6000 limit. Consider making this value dynamically computed based on the number of adapters or using a higher ceiling such as 65536.