You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2022/02/14 06:36:41 UTC
[GitHub] [airflow] ferruzzi commented on a change in pull request #21523: Update EKS sample DAGs and docs
ferruzzi commented on a change in pull request #21523:
URL: https://github.com/apache/airflow/pull/21523#discussion_r805539267
##########
File path: airflow/providers/amazon/aws/example_dags/example_eks_templated.py
##########
@@ -49,50 +44,53 @@
"""
with DAG(
- dag_id='to-publish-manuals-templated',
- default_args={'cluster_name': "{{ dag_run.conf['cluster_name'] }}"},
+ dag_id='example_eks_templated',
schedule_interval=None,
start_date=datetime(2021, 1, 1),
- catchup=False,
- max_active_runs=1,
tags=['example', 'templated'],
+ catchup=False,
# render_template_as_native_obj=True is what converts the Jinja to Python objects, instead of a string.
render_template_as_native_obj=True,
) as dag:
- SUBNETS = os.environ.get('EKS_DEMO_SUBNETS', 'subnet-12345ab subnet-67890cd').split(' ')
- VPC_CONFIG = {
- 'subnetIds': SUBNETS,
- 'endpointPublicAccess': True,
- 'endpointPrivateAccess': False,
- }
+
+ CLUSTER_NAME = "{{ dag_run.conf['cluster_name'] }}"
+ NODEGROUP_NAME = "{{ dag_run.conf['nodegroup_name'] }}"
+ VPC_CONFIG = json.loads("{{ dag_run.conf['resources_vpc_config'] }}")
Review comment:
Thanks. Yeah, that is what I was gathering but I haven't come across an answer yet. Jinja is new to me so this may be really obvious. Does/can jinja magically know it should be a dict, or do I change the operator to accept type Union[dict, str], and if it's a string then handle the conversion inside the operator?
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org