Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added 'worker_type' and 'glue_version' attributes to the module #370

Merged
34 changes: 32 additions & 2 deletions plugins/modules/aws_glue_job.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@
description:
- Manage an AWS Glue job. See U(https://aws.amazon.com/glue/) for details.
requirements: [ boto3 ]
author: "Rob White (@wimnat)"
author:
- "Rob White (@wimnat)"
- "Vijayanand Sharma (@vijayanandsharma)"
options:
allocated_capacity:
description:
Expand Down Expand Up @@ -75,6 +77,19 @@
description:
- The job timeout in minutes.
type: int
glue_version:
description:
- Glue version determines the versions of Apache Spark and Python that AWS Glue supports
tremble marked this conversation as resolved.
Show resolved Hide resolved
type: str
tremble marked this conversation as resolved.
Show resolved Hide resolved
worker_type:
description:
- The type of predefined worker that is allocated when a job runs. Accepts a value of Standard, G.1X, or G.2X.
tremble marked this conversation as resolved.
Show resolved Hide resolved
choices: [ 'Standard', 'G.1X', 'G.2X' ]
type: str
tremble marked this conversation as resolved.
Show resolved Hide resolved
number_of_workers:
description:
- The number of workers of a defined workerType that are allocated when a job runs.
type: int
tremble marked this conversation as resolved.
Show resolved Hide resolved
extends_documentation_fragment:
- amazon.aws.aws
- amazon.aws.ec2
Expand Down Expand Up @@ -248,6 +263,12 @@ def _compare_glue_job_params(user_params, current_params):
return True
if 'Timeout' in user_params and user_params['Timeout'] != current_params['Timeout']:
return True
if 'GlueVersion' in user_params and user_params['GlueVersion'] != current_params['GlueVersion']:
return True
if 'WorkerType' in user_params and user_params['WorkerType'] != current_params['WorkerType']:
return True
if 'NumberOfWorkers' in user_params and user_params['NumberOfWorkers'] != current_params['NumberOfWorkers']:
return True

return False

Expand Down Expand Up @@ -282,6 +303,12 @@ def create_or_update_glue_job(connection, module, glue_job):
params['MaxRetries'] = module.params.get("max_retries")
if module.params.get("timeout") is not None:
params['Timeout'] = module.params.get("timeout")
if module.params.get("glue_version") is not None:
params['GlueVersion'] = module.params.get("glue_version")
if module.params.get("worker_type") is not None:
params['WorkerType'] = module.params.get("worker_type")
if module.params.get("number_of_workers") is not None:
params['NumberOfWorkers'] = module.params.get("number_of_workers")

# If glue_job is not None then check if it needs to be modified, else create it
if glue_job:
Expand Down Expand Up @@ -345,7 +372,10 @@ def main():
name=dict(required=True, type='str'),
role=dict(type='str'),
state=dict(required=True, choices=['present', 'absent'], type='str'),
timeout=dict(type='int')
timeout=dict(type='int'),
glue_version=dict(type='str'),
worker_type=dict(choices=['Standard', 'G.1X', 'G.2X'], type='str'),
number_of_workers=dict(type='int')
tremble marked this conversation as resolved.
Show resolved Hide resolved
)
)

Expand Down