pcf.particle.aws.batch package

Submodules

pcf.particle.aws.batch.batch_compute_environment module

class pcf.particle.aws.batch.batch_compute_environment.BatchComputeEnvironment(particle_definition, session=None)

Bases: pcf.core.aws_resource.AWSResource

This is the implementation of Amazon’s Batch Compute Environment. https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/batch.html#Batch.Client.create_compute_environment

UNIQUE_KEYS = ['aws_resource.computeEnvironmentName']
UPDATE_PARAM_FILTER = {'computeResources', 'state'}
_set_unique_keys()

Logic that sets keys from state definition that are used to uniquely identify the BatchComputeEnvironment

_start()

Calls boto3 create_compute_environment() and sets the status to ENABLED by default.

Returns:boto3 create_compute_environment() response
_stop()

Calls boto3 update_compute_environment() and sets state to DISABLED

Returns:boto3 update_compute_environment() response
_terminate()

Sets state DISABLED then calls boto3 delete_compute_environment() to terminate

Returns:boto3 delete_compute_environment() response
_update()

Calls boto3 update_compute_environment(). Can only update fields in UPDATE_PARAM_FILTER.

Returns:boto3 put_attributes() response
enable()

Calls boto3 update_compute_environment() and sets state to ENABLED

Returns:boto3 update_compute_environment() response
flavor = 'batch_compute_environment'
get_status()

Calls boto3 describe_compute_environments.

Returns:status or {}
is_state_definition_equivalent()

Checks if the current state definition and desired state definitions are equivalent including attributes.

Returns:bool
state_lookup = {'CREATING': <State.pending: 4>, 'DELETED': <State.terminated: 3>, 'DELETING': <State.pending: 4>, 'INVALID': <State.terminated: 3>, 'UPDATING': <State.pending: 4>, 'VALID': <State.running: 1>}
sync_state()

Calls get_status() and updates the current_state_definition and the state.

pcf.particle.aws.batch.batch_job_queue module

class pcf.particle.aws.batch.batch_job_queue.BatchJobQueue(particle_definition, session=None)

Bases: pcf.core.aws_resource.AWSResource

This is the implementation of Amazon’s Batch Job Queue. https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/batch.html#Batch.Client.create_job_queue

UNIQUE_KEYS = ['aws_resource.jobQueueName']
UPDATE_PARAM_FILTER = {'computeEnvironmentOrder', 'priority', 'state'}
_set_unique_keys()

Logic that sets keys from state definition that are used to uniquely identify the BatchJobQueue

_start()

Calls boto3 create_job_queue() and sets the status to ENABLED by default.

Returns:boto3 create_job_queue() response
_stop()

Calls boto3 update_job_queue() and sets state to DISABLED

Returns:boto3 update_compute_environment() response
_terminate()

Sets state DISABLED then calls boto3 delete_job_queue() to terminate

Returns:boto3 delete_job_queue() response
_update()

Calls boto3 update_job_queue(). Can only update fields in UPDATE_PARAM_FILTER.

Returns:boto3 put_attributes() response
enable()

Calls boto3 update_job_queue() and sets state to ENABLED

Returns:boto3 update_job_queue() response
flavor = 'batch_job_queue'
get_status()

Calls boto3 describe_job_queues.

Returns:status or {}
is_state_definition_equivalent()

Checks if the current state definition and desired state definitions are equivalent including attributes.

Returns:bool
state_lookup = {'CREATING': <State.pending: 4>, 'DELETED': <State.terminated: 3>, 'DELETING': <State.pending: 4>, 'INVALID': <State.terminated: 3>, 'UPDATING': <State.pending: 4>, 'VALID': <State.running: 1>}
sync_state()

Calls get_status() and updates the current_state_definition and the state.

Module contents