Skip to content

Commit 2c8f4a7

Browse files
committed
Bumping version to 0.0.16
1 parent ef02cee commit 2c8f4a7

File tree

5 files changed

+22
-6
lines changed

5 files changed

+22
-6
lines changed

README.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
> Utility belt to handle data on AWS.
44
5-
[![Release](https://img.shields.io/badge/release-0.0.15-brightgreen.svg)](https://pypi.org/project/awswrangler/)
5+
[![Release](https://img.shields.io/badge/release-0.0.16-brightgreen.svg)](https://pypi.org/project/awswrangler/)
66
[![Downloads](https://img.shields.io/pypi/dm/awswrangler.svg)](https://pypi.org/project/awswrangler/)
77
[![Python Version](https://img.shields.io/badge/python-3.6%20%7C%203.7-brightgreen.svg)](https://pypi.org/project/awswrangler/)
88
[![Documentation Status](https://readthedocs.org/projects/aws-data-wrangler/badge/?version=latest)](https://aws-data-wrangler.readthedocs.io/en/latest/?badge=latest)
@@ -283,7 +283,10 @@ cluster_id = session.emr.create_cluster(
283283
spark_jars_path=[f"s3://...jar"],
284284
maximize_resource_allocation=True,
285285
keep_cluster_alive_when_no_steps=True,
286-
termination_protected=False
286+
termination_protected=False,
287+
tags={
288+
"foo": "boo"
289+
}
287290
)
288291
print(cluster_id)
289292
```

awswrangler/__version__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
__title__ = "awswrangler"
22
__description__ = "Utility belt to handle data on AWS."
3-
__version__ = "0.0.15"
3+
__version__ = "0.0.16"
44
__license__ = "Apache License 2.0"

awswrangler/emr.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,10 @@ def _build_cluster_args(**pars):
267267
}
268268
args["Instances"]["InstanceFleets"].append(fleet_task)
269269

270+
# Tags
271+
if pars["tags"] is not None:
272+
args["Tags"] = [{"Key": k, "Value": v} for k, v in pars["tags"].items()]
273+
270274
logger.info(f"args: \n{json.dumps(args, default=str, indent=4)}")
271275
return args
272276

@@ -318,7 +322,8 @@ def create_cluster(self,
318322
maximize_resource_allocation: bool = False,
319323
steps: Optional[List[Dict[str, Collection[str]]]] = None,
320324
keep_cluster_alive_when_no_steps: bool = True,
321-
termination_protected: bool = False):
325+
termination_protected: bool = False,
326+
tags: Optional[Dict[str, str]] = None):
322327
"""
323328
Create a EMR cluster with instance fleets configuration
324329
https://docs.aws.amazon.com/emr/latest/ManagementGuide/emr-instance-fleet.html
@@ -370,6 +375,7 @@ def create_cluster(self,
370375
:param steps: Steps definitions (Obs: Use EMR.build_step() to build that)
371376
:param keep_cluster_alive_when_no_steps: Specifies whether the cluster should remain available after completing all steps
372377
:param termination_protected: Specifies whether the Amazon EC2 instances in the cluster are protected from termination by API calls, user intervention, or in the event of a job-flow error.
378+
:param tags: Key/Value collection to put on the Cluster. (e.g. {"foo": "boo", "bar": "xoo"})
373379
:return: Cluster ID (string)
374380
"""
375381
args = EMR._build_cluster_args(**locals())

docs/source/examples.rst

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,10 @@ Create EMR cluster
244244
spark_jars_path=[f"s3://...jar"],
245245
maximize_resource_allocation=True,
246246
keep_cluster_alive_when_no_steps=True,
247-
termination_protected=False
247+
termination_protected=False,
248+
tags={
249+
"foo": "boo"
250+
}
248251
)
249252
print(cluster_id)
250253

testing/test_awswrangler/test_emr.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,11 @@ def test_cluster_single_node(session, bucket, cloudformation_outputs):
133133
spark_defaults={"spark.default.parallelism": "400"},
134134
maximize_resource_allocation=True,
135135
keep_cluster_alive_when_no_steps=False,
136-
termination_protected=False)
136+
termination_protected=False,
137+
tags={
138+
"foo": "boo",
139+
"bar": "xoo"
140+
})
137141
sleep(10)
138142
cluster_state = session.emr.get_cluster_state(cluster_id=cluster_id)
139143
print(f"cluster_state: {cluster_state}")

0 commit comments

Comments
 (0)