Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions airflow/providers/amazon/aws/hooks/emr.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ def submit_job(
job_driver: dict,
configuration_overrides: Optional[dict] = None,
client_request_token: Optional[str] = None,
tags: Optional[dict] = None,
) -> str:
"""
Submit a job to the EMR Containers API and return the job ID.
Expand All @@ -148,6 +149,7 @@ def submit_job(
specifically either application configuration or monitoring configuration.
:param client_request_token: The client idempotency token of the job run request.
Use this if you want to specify a unique ID to prevent two jobs from getting started.
:param tags: The tags assigned to job runs.
:return: Job ID
"""
params = {
Expand All @@ -157,6 +159,7 @@ def submit_job(
"releaseLabel": release_label,
"jobDriver": job_driver,
"configurationOverrides": configuration_overrides or {},
"tags": tags or {},
}
if client_request_token:
params["clientToken"] = client_request_token
Expand Down
5 changes: 5 additions & 0 deletions airflow/providers/amazon/aws/operators/emr.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,8 @@ class EmrContainerOperator(BaseOperator):
:param poll_interval: Time (in seconds) to wait between two consecutive calls to check query status on EMR
:param max_tries: Maximum number of times to wait for the job run to finish.
Defaults to None, which will poll until the job is *not* in a pending, submitted, or running state.
:param tags: The tags assigned to job runs.
Defaults to None
"""

template_fields: Sequence[str] = (
Expand All @@ -160,6 +162,7 @@ def __init__(
aws_conn_id: str = "aws_default",
poll_interval: int = 30,
max_tries: Optional[int] = None,
tags: Optional[dict] = None,
**kwargs: Any,
) -> None:
super().__init__(**kwargs)
Expand All @@ -173,6 +176,7 @@ def __init__(
self.client_request_token = client_request_token or str(uuid4())
self.poll_interval = poll_interval
self.max_tries = max_tries
self.tags = tags
self.job_id: Optional[str] = None

@cached_property
Expand All @@ -192,6 +196,7 @@ def execute(self, context: 'Context') -> Optional[str]:
self.job_driver,
self.configuration_overrides,
self.client_request_token,
self.tags,
)
query_status = self.hook.poll_query_status(self.job_id, self.max_tries, self.poll_interval)

Expand Down