Skip to content

Commit

Permalink
Add docs
Browse files Browse the repository at this point in the history
  • Loading branch information
pankajastro committed Mar 19, 2024
1 parent 1d33b50 commit 2b6d4c8
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 7 deletions.
5 changes: 3 additions & 2 deletions astronomer/providers/apache/hive/example_dags/example_hive.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,7 @@ def add_inbound_rule_for_security_group(task_instance: Any) -> None:


def revoke_inbound_rules(task_instance):
"""Remove an ingress rule from security group"""
import boto3

current_docker_ip = get("https://api.ipify.org").text
Expand All @@ -222,8 +223,8 @@ def revoke_inbound_rules(task_instance):
CidrIp=ip_range,
FromPort=22,
GroupId=task_instance.xcom_pull(
key="cluster_response_master_security_group", task_ids=["describe_created_cluster"]
)[0],
key="cluster_response_master_security_group", task_ids=["describe_created_cluster"]
)[0],
IpProtocol="tcp",
)
logging.info("%s", response)
Expand Down
5 changes: 3 additions & 2 deletions astronomer/providers/apache/livy/example_dags/example_livy.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@ def add_inbound_rule_for_security_group(task_instance: Any) -> None:


def revoke_inbound_rules(task_instance):
"""Remove an ingress rule from security group"""
import boto3

current_docker_ip = get("https://api.ipify.org").text
Expand All @@ -186,8 +187,8 @@ def revoke_inbound_rules(task_instance):
FromPort=LIVY_OPERATOR_INGRESS_PORT,
ToPort=LIVY_OPERATOR_INGRESS_PORT,
GroupId=task_instance.xcom_pull(
key="cluster_response_master_security_group", task_ids=["describe_created_cluster"]
)[0],
key="cluster_response_master_security_group", task_ids=["describe_created_cluster"]
)[0],
IpProtocol="tcp",
)
logging.info("%s", response)
Expand Down
9 changes: 6 additions & 3 deletions astronomer/providers/sftp/example_dags/example_sftp.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ def add_inbound_rule_for_security_group(task_instance: "TaskInstance") -> None:


def revoke_inbound_rules(task_instance):
"""Remove an ingress rule from security group"""
import boto3

current_docker_ip = get("https://api.ipify.org").text
Expand All @@ -169,8 +170,8 @@ def revoke_inbound_rules(task_instance):
FromPort=22,
ToPort=22,
GroupId=task_instance.xcom_pull(
key="cluster_response_master_security_group", task_ids=["describe_created_cluster"]
)[0],
key="cluster_response_master_security_group", task_ids=["describe_created_cluster"]
)[0],
IpProtocol="tcp",
)
logging.info("%s", response)
Expand Down Expand Up @@ -299,7 +300,9 @@ def check_dag_status(**kwargs: Any) -> None:
)

revoke_inbound_rules = PythonOperator(
task_id="revoke_inbound_rules", trigger_rule=TriggerRule.ALL_DONE, python_callable=revoke_inbound_rules
task_id="revoke_inbound_rules",
trigger_rule=TriggerRule.ALL_DONE,
python_callable=revoke_inbound_rules,
)

dag_final_status = PythonOperator(
Expand Down

0 comments on commit 2b6d4c8

Please sign in to comment.