Repository navigation
Description
Problem
Currently, local executors are often behaving differently, despite most containerization engines aligning with Docker CLI options or supporting similar functionalities.
Example: "How are CPUs allocated ?" differs along executors:
All the following containerization engines, which are implemented as local executors, support the --cpu-shares (flexible allocation) and --cpus (fixed allocation) flags but make different use of them, which causes a confusing mix.
Docker
Docker resource constraints - documentation
Implementation (uses --cpu-shares as default, but switch via cpuLimits flag):
nextflow/modules/nextflow/src/main/groovy/nextflow/container/DockerBuilder.groovy
Lines 132 to 135 in 60c7ae9
| if( cpus && cpuLimits ) | |
| result << "--cpus ${cpus} " | |
| else if( cpus && !legacy ) | |
| result << "--cpu-shares ${cpus * 1024} " |
Apptainer & Singularity:
Singularity CPU limits - documentation
Apptainer CPU limits - documentation
Implementation (uses --cpu):
nextflow/modules/nextflow/src/main/groovy/nextflow/container/SingularityBuilder.groovy
Lines 138 to 140 in 98e8573
| if( resourceLimits ) { | |
| if( cpus ) | |
| result << "--cpus ${cpus} " |
Podman
Podman CPU shares - documentation
Implementation (uses --cpu-shares):
nextflow/modules/nextflow/src/main/groovy/nextflow/container/PodmanBuilder.groovy
Lines 135 to 137 in ab6be6d
| if( cpus ) { | |
| result << "--cpu-shares ${cpus * 1024} " | |
| } |
Suggested solution
Either:
- Make a class with common options that are handled in the same way
- or align how the behaviour of each executor independently
Activity