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

Remove local set_env and check_limits methods #46

Merged
merged 2 commits into from
Dec 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,10 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
- Add new flow diagram to README
- Add additional details to Pipeline Steps section of README
- Option to provide base recalibration tables for any subset of samples to skip `BaseRecalibrator`

### [Changed]
- Use modularized `set_env` function
- Use modularized `check_limits` function

---

Expand Down
36 changes: 0 additions & 36 deletions config/methods.config
Original file line number Diff line number Diff line change
Expand Up @@ -6,42 +6,6 @@ includeConfig "${projectDir}/external/pipeline-Nextflow-config/config/schema/sch
includeConfig "${projectDir}/external/pipeline-Nextflow-config/config/retry/retry.config"

methods {
// Function to ensure that resource requirements don't go beyond
// a maximum limit or below a minimum limit
check_limits = { obj, type ->
if (type == 'memory') {
try {
if (obj.compareTo(params.max_memory as nextflow.util.MemoryUnit) == 1)
return params.max_memory as nextflow.util.MemoryUnit
else if (obj.compareTo(params.min_memory as nextflow.util.MemoryUnit) == -1)
return params.min_memory as nextflow.util.MemoryUnit
else
return obj
} catch (all) {
println " ### WARNING ### Max memory '${params.max_memory}' or min memory '${params.min_memory}' is not valid! Using default value: $obj"
return obj
}
} else if (type == 'time') {
try {
if (obj.compareTo(params.max_time as nextflow.util.Duration) == 1)
return params.max_time as nextflow.util.Duration
else if (obj.compareTo(params.min_time as nextflow.util.Duration) == -1)
return params.min_time as nextflow.util.Duration
else
return obj
} catch (all) {
println " ### WARNING ### Max time '${params.max_time}' or min time '${params.min_time}' is not valid! Using default value: $obj"
return obj
}
} else if (type == 'cpus') {
try {
return Math.max( Math.min( obj, params.max_cpus as int ), params.min_cpus as int )
} catch (all) {
println " ### WARNING ### Max cpus '${params.max_cpus}' or min cpus '${params.min_cpus}' is not valid! Using default value: $obj"
return obj
}
}
}

set_log_output_dir = {
def tz = TimeZone.getTimeZone("UTC")
Expand Down
Loading