Skip to content

Commit

Permalink
More robust parsing of shm-size containerOptions
Browse files Browse the repository at this point in the history
This commit ensures that the `shm-size` option is correctly parsed from the containerOptions. This is necessary to ensure that the correct value in MiB is passed to the AWS Batch API when creating a job definition.

Signed-off-by: Rob Syme <[email protected]>
  • Loading branch information
robsyme committed Jul 26, 2024
1 parent bc2fb40 commit aebffa7
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import com.amazonaws.services.batch.model.Tmpfs
import com.amazonaws.services.batch.model.Ulimit
import groovy.transform.CompileStatic
import nextflow.util.CmdLineOptionMap
import nextflow.util.MemoryUnit

/**
* Maps task container options to AWS container properties
Expand Down Expand Up @@ -106,7 +107,8 @@ class AwsContainerOptionsMapper {
// shared Memory Size
def value = findOptionWithSingleValue(options, 'shm-size')
if ( value ) {
params.setSharedMemorySize(value as Integer)
MemoryUnit sharedMemorySize = (value as MemoryUnit)
params.setSharedMemorySize(sharedMemorySize.mega as Integer)
atLeastOneSet = true
}

Expand Down Expand Up @@ -156,6 +158,7 @@ class AwsContainerOptionsMapper {
* @return the value, if any, or empty
*/
protected static String findOptionWithSingleValue(CmdLineOptionMap options, String name) {
println "Inside findOptionWithSingleValue looking for $name in $options"
options.getFirstValueOrDefault(name,null) as String
}

Expand Down

0 comments on commit aebffa7

Please sign in to comment.