Class: AWSCDK::Batch::CfnJobDefinition::LinuxParametersProperty

Inherits:
Jsii::Struct
  • Object
show all
Defined in:
batch/cfn_job_definition.rb

Overview

Linux-specific modifications that are applied to the container, such as details for device mappings.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(devices: nil, init_process_enabled: nil, max_swap: nil, shared_memory_size: nil, swappiness: nil, tmpfs: nil) ⇒ LinuxParametersProperty

Returns a new instance of LinuxParametersProperty.

Parameters:



2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
# File 'batch/cfn_job_definition.rb', line 2309

def initialize(devices: nil, init_process_enabled: nil, max_swap: nil, shared_memory_size: nil, swappiness: nil, tmpfs: nil)
  @devices = devices
  Jsii::Type.check_type(@devices, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3siZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifSx7ImNvbGxlY3Rpb24iOnsiZWxlbWVudHR5cGUiOnsidW5pb24iOnsidHlwZXMiOlt7ImZxbiI6ImF3cy1jZGstbGliLklSZXNvbHZhYmxlIn0seyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfYmF0Y2guQ2ZuSm9iRGVmaW5pdGlvbi5EZXZpY2VQcm9wZXJ0eSJ9XX19LCJraW5kIjoiYXJyYXkifX1dfX0=")), "devices") unless @devices.nil?
  @init_process_enabled = init_process_enabled
  Jsii::Type.check_type(@init_process_enabled, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3sicHJpbWl0aXZlIjoiYm9vbGVhbiJ9LHsiZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifV19fQ==")), "initProcessEnabled") unless @init_process_enabled.nil?
  @max_swap = max_swap
  Jsii::Type.check_type(@max_swap, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "maxSwap") unless @max_swap.nil?
  @shared_memory_size = shared_memory_size
  Jsii::Type.check_type(@shared_memory_size, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "sharedMemorySize") unless @shared_memory_size.nil?
  @swappiness = swappiness
  Jsii::Type.check_type(@swappiness, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "swappiness") unless @swappiness.nil?
  @tmpfs = tmpfs
  Jsii::Type.check_type(@tmpfs, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3siZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifSx7ImNvbGxlY3Rpb24iOnsiZWxlbWVudHR5cGUiOnsidW5pb24iOnsidHlwZXMiOlt7ImZxbiI6ImF3cy1jZGstbGliLklSZXNvbHZhYmxlIn0seyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfYmF0Y2guQ2ZuSm9iRGVmaW5pdGlvbi5UbXBmc1Byb3BlcnR5In1dfX0sImtpbmQiOiJhcnJheSJ9fV19fQ==")), "tmpfs") unless @tmpfs.nil?
end

Instance Attribute Details

#devicesAWSCDK::IResolvable, ... (readonly)

Any of the host devices to expose to the container.

This parameter maps to Devices in the Create a container section of the Docker Remote API and the --device option to docker run .

This parameter isn't applicable to jobs that are running on Fargate resources. Don't provide it for these jobs.



2332
2333
2334
# File 'batch/cfn_job_definition.rb', line 2332

def devices
  @devices
end

#init_process_enabledBoolean, ... (readonly)

If true, run an init process inside the container that forwards signals and reaps processes.

This parameter maps to the --init option to docker run . This parameter requires version 1.25 of the Docker Remote API or greater on your container instance. To check the Docker Remote API version on your container instance, log in to your container instance and run the following command: sudo docker version | grep "Server API version"



2339
2340
2341
# File 'batch/cfn_job_definition.rb', line 2339

def init_process_enabled
  @init_process_enabled
end

#max_swapNumeric? (readonly)

The total amount of swap memory (in MiB) a container can use.

This parameter is translated to the --memory-swap option to docker run where the value is the sum of the container memory plus the max_swap value. For more information, see --memory-swap details in the Docker documentation.

If a max_swap value of 0 is specified, the container doesn't use swap. Accepted values are 0 or any positive integer. If the max_swap parameter is omitted, the container doesn't use the swap configuration for the container instance on which it runs. A max_swap value must be set for the swappiness parameter to be used.

This parameter isn't applicable to jobs that are running on Fargate resources. Don't provide it for these jobs.



2350
2351
2352
# File 'batch/cfn_job_definition.rb', line 2350

def max_swap
  @max_swap
end

#shared_memory_sizeNumeric? (readonly)

The value for the size (in MiB) of the /dev/shm volume.

This parameter maps to the --shm-size option to docker run .

This parameter isn't applicable to jobs that are running on Fargate resources. Don't provide it for these jobs.



2359
2360
2361
# File 'batch/cfn_job_definition.rb', line 2359

def shared_memory_size
  @shared_memory_size
end

#swappinessNumeric? (readonly)

You can use this parameter to tune a container's memory swappiness behavior.

A swappiness value of 0 causes swapping to not occur unless absolutely necessary. A swappiness value of 100 causes pages to be swapped aggressively. Valid values are whole numbers between 0 and 100 . If the swappiness parameter isn't specified, a default value of 60 is used. If a value isn't specified for max_swap , then this parameter is ignored. If max_swap is set to 0, the container doesn't use swap. This parameter maps to the --memory-swappiness option to docker run .

Consider the following when you use a per-container swap configuration.

  • Swap space must be enabled and allocated on the container instance for the containers to use.

By default, the Amazon ECS optimized AMIs don't have swap enabled. You must enable swap on the instance to use this feature. For more information, see Instance store swap volumes in the Amazon EC2 User Guide for Linux Instances or How do I allocate memory to work as swap space in an Amazon EC2 instance by using a swap file?

  • The swap space parameters are only supported for job definitions using EC2 resources.
  • If the max_swap and swappiness parameters are omitted from a job definition, each container has a default swappiness value of 60. Moreover, the total swap usage is limited to two times the memory reservation of the container.

This parameter isn't applicable to jobs that are running on Fargate resources. Don't provide it for these jobs.



2377
2378
2379
# File 'batch/cfn_job_definition.rb', line 2377

def swappiness
  @swappiness
end

#tmpfsAWSCDK::IResolvable, ... (readonly)

The container path, mount options, and size (in MiB) of the tmpfs mount.

This parameter maps to the --tmpfs option to docker run .

This parameter isn't applicable to jobs that are running on Fargate resources. Don't provide this parameter for this resource type.



2386
2387
2388
# File 'batch/cfn_job_definition.rb', line 2386

def tmpfs
  @tmpfs
end

Class Method Details

.jsii_propertiesObject



2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
# File 'batch/cfn_job_definition.rb', line 2388

def self.jsii_properties
  {
    :devices => "devices",
    :init_process_enabled => "initProcessEnabled",
    :max_swap => "maxSwap",
    :shared_memory_size => "sharedMemorySize",
    :swappiness => "swappiness",
    :tmpfs => "tmpfs",
  }
end

Instance Method Details

#to_jsiiObject



2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
# File 'batch/cfn_job_definition.rb', line 2399

def to_jsii
  result = {}
  result.merge!({
    "devices" => @devices,
    "initProcessEnabled" => @init_process_enabled,
    "maxSwap" => @max_swap,
    "sharedMemorySize" => @shared_memory_size,
    "swappiness" => @swappiness,
    "tmpfs" => @tmpfs,
  })
  result.compact
end