ferruzzi commented on code in PR #31032:
URL: https://github.com/apache/airflow/pull/31032#discussion_r1183179432
##########
airflow/providers/amazon/aws/links/emr.py:
##########
@@ -33,3 +40,23 @@ class EmrLogsLink(BaseAwsLink):
name = "EMR Cluster Logs"
key = "emr_logs"
format_str = BASE_AWS_CONSOLE_LINK +
"/s3/buckets/{log_uri}?region={region_name}&prefix={job_flow_id}/"
+
+
+def get_log_uri(
+ *, cluster: dict[str, Any] | None = None, emr_client: boto3.client = None,
job_flow_id: str | None = None
+) -> str:
+ """
+ Retrieves the S3 URI to the EMR Job logs. Requires either the output of a
+ describe_cluster call or both an EMR Client and a job_flow_id to look it
up.
+ """
+ if not exactly_one(cluster, emr_client and job_flow_id):
Review Comment:
Could also do an XOR `bool(cluster) ^ bool(emr_client and job_flow_id)`
here, but the `exactly_one` helper was handy and more clear IMHO.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]