-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
305dd43
commit a619098
Showing
45 changed files
with
3,670 additions
and
264 deletions.
There are no files selected for viewing
60 changes: 0 additions & 60 deletions
60
infrastructure/functions/s3_event_bridge_to_sfn_execute/lambda_function.py
This file was deleted.
Oops, something went wrong.
1 change: 0 additions & 1 deletion
1
infrastructure/functions/s3_event_bridge_to_sfn_execute/requirements.txt
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Empty file.
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,94 @@ | ||
import logging | ||
import time | ||
|
||
import pendulum | ||
from airflow import DAG | ||
from airflow.operators.dummy_operator import DummyOperator as EmptyOperator | ||
from airflow.operators.python import PythonOperator | ||
|
||
|
||
def log_task(text: str): | ||
logging.info(text) | ||
|
||
|
||
def discover_from_cmr_task(text): | ||
log_task(text) | ||
|
||
|
||
def discover_from_s3_task(text): | ||
log_task("I am discovering") | ||
time.sleep(1) | ||
log_task("Done discovering") | ||
log_task(text) | ||
|
||
|
||
def move_files_to_maap_store_task(text): | ||
log_task("I am moving files") | ||
time.sleep(3) | ||
log_task("Done moving files") | ||
log_task(text) | ||
|
||
|
||
def generate_cmr_metadata_task(text): | ||
log_task(text) | ||
|
||
|
||
def push_to_cmr_task(text): | ||
log_task(text) | ||
|
||
|
||
with DAG( | ||
dag_id="example_etl_flow_test", | ||
start_date=pendulum.today("UTC").add(days=-1), | ||
schedule_interval=None, | ||
tags=["example"], | ||
) as dag: | ||
|
||
start = EmptyOperator(task_id="start", dag=dag) | ||
|
||
discover_from_cmr = PythonOperator( | ||
task_id="discover_from_cmr", | ||
python_callable=discover_from_cmr_task, | ||
op_kwargs={"text": "Discover from CMR"}, | ||
dag=dag, | ||
) | ||
|
||
discover_from_s3 = PythonOperator( | ||
task_id="discover_from_s3", | ||
python_callable=discover_from_s3_task, | ||
op_kwargs={"text": "Discover from S3"}, | ||
dag=dag, | ||
) | ||
|
||
move_files_to_maap_store = PythonOperator( | ||
task_id="move_files_to_maap_store", | ||
python_callable=move_files_to_maap_store_task, | ||
op_kwargs={"text": "Moving Files to MAAP store"}, | ||
dag=dag, | ||
) | ||
|
||
generate_cmr_metadata = PythonOperator( | ||
task_id="generate_cmr_metadata", | ||
python_callable=generate_cmr_metadata_task, | ||
op_kwargs={"text": "Generate CMR metadata"}, | ||
dag=dag, | ||
) | ||
|
||
push_to_cmr = PythonOperator( | ||
task_id="push_to_cmr", | ||
python_callable=push_to_cmr_task, | ||
op_kwargs={"text": "Push to CMR"}, | ||
dag=dag, | ||
) | ||
|
||
end = EmptyOperator(task_id="end", dag=dag) | ||
|
||
start >> discover_from_cmr | ||
|
||
start >> discover_from_s3 >> move_files_to_maap_store | ||
( | ||
[discover_from_cmr, move_files_to_maap_store] | ||
>> generate_cmr_metadata | ||
>> push_to_cmr | ||
>> end | ||
) |
Oops, something went wrong.