-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #9 from bcgov/rar-data-extract
Convert RAR data extract to Airflow DAG
- Loading branch information
Showing
1 changed file
with
42 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
from airflow import DAG | ||
from pendulum import datetime | ||
from kubernetes import client | ||
from airflow.providers.cncf.kubernetes.operators.pod import KubernetesPodOperator | ||
from airflow.providers.cncf.kubernetes.secret import Secret | ||
from datetime import timedelta | ||
|
||
rar_secrets = Secret("env", None, "rar-data-extract") | ||
|
||
default_args = { | ||
'owner': 'Data Foundations', | ||
"email": ["[email protected]"], | ||
'retries': 1, | ||
'retry_delay': timedelta(minutes=5), | ||
"email_on_failure": True, | ||
"email_on_retry": True, | ||
} | ||
|
||
with DAG( | ||
start_date=datetime(2024, 7, 23), | ||
catchup=False, | ||
schedule='0 4 * * *', | ||
dag_id="housing-pipeline-rar", | ||
default_args=default_args, | ||
description='DAG to replicate RAR data extract to S3 bucket so that it can be accessed via BCBox', | ||
) as dag: | ||
run_replication = KubernetesPodOperator( | ||
task_id="run_replication", | ||
image="ghcr.io/bcgov/nr-dap-ods-ora2s3:main", | ||
image_pull_policy="Always", | ||
in_cluster=True, | ||
service_account_name="airflow-admin", | ||
name=f"run_rar_s3_replication", | ||
labels={"DataClass": "Medium", | ||
"ConnectionType": "database", | ||
"Release": "airflow"}, | ||
is_delete_operator_pod=False, | ||
secrets=[rar_secrets], | ||
container_resources= client.V1ResourceRequirements( | ||
requests={"cpu": "50m", "memory": "512Mi"}, | ||
limits={"cpu": "100m", "memory": "1024Mi"}) | ||
) |