LinuxParameters

class aws_cdk.aws_batch.LinuxParameters(scope, id, *, init_process_enabled=None, max_swap=None, shared_memory_size=None, swappiness=None)

Bases: Construct

Linux-specific options that are applied to the container.

ExampleMetadata:

fixture=_generated

Example:

# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
import aws_cdk as cdk
from aws_cdk import aws_batch as batch

# size: cdk.Size

linux_parameters = batch.LinuxParameters(self, "MyLinuxParameters",
    init_process_enabled=False,
    max_swap=size,
    shared_memory_size=size,
    swappiness=123
)

Constructs a new instance of the LinuxParameters class.

Parameters:
  • scope (Construct) –

  • id (str) –

  • init_process_enabled (Optional[bool]) – Specifies whether to run an init process inside the container that forwards signals and reaps processes. Default: false

  • max_swap (Optional[Size]) – The total amount of swap memory a container can use. This parameter will be translated to the –memory-swap option to docker run. This parameter is only supported when you are using the EC2 launch type. Accepted values are positive integers. Default: No swap.

  • shared_memory_size (Optional[Size]) – The value for the size of the /dev/shm volume. Default: No shared memory.

  • swappiness (Union[int, float, None]) – This allows you to tune a container’s memory swappiness behavior. This parameter maps to the –memory-swappiness option to docker run. The swappiness relates to the kernel’s tendency to swap memory. A value of 0 will cause swapping to not happen unless absolutely necessary. A value of 100 will cause pages to be swapped very aggressively. This parameter is only supported when you are using the EC2 launch type. Accepted values are whole numbers between 0 and 100. If a value is not specified for maxSwap then this parameter is ignored. Default: 60

Methods

add_devices(*device)

Adds one or more host devices to a container.

Parameters:

device (Device) –

Return type:

None

add_tmpfs(*tmpfs)

Specifies the container path, mount options, and size (in MiB) of the tmpfs mount for a container.

Only works with EC2 launch type.

Parameters:

tmpfs (Tmpfs) –

Return type:

None

render_linux_parameters()

Renders the Linux parameters to the Batch version of this resource, which does not have ‘capabilities’ and requires tmpfs.containerPath to be defined.

Return type:

LinuxParametersProperty

to_string()

Returns a string representation of this construct.

Return type:

str

Attributes

node

The tree node.

Static Methods

classmethod is_construct(x)

Checks if x is a construct.

Use this method instead of instanceof to properly detect Construct instances, even when the construct library is symlinked.

Explanation: in JavaScript, multiple copies of the constructs library on disk are seen as independent, completely different libraries. As a consequence, the class Construct in each copy of the constructs library is seen as a different class, and an instance of one class will not test as instanceof the other class. npm install will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of the constructs library can be accidentally installed, and instanceof will behave unpredictably. It is safest to avoid using instanceof, and using this type-testing method instead.

Parameters:

x (Any) – Any object.

Return type:

bool

Returns:

true if x is an object created from a class which extends Construct.