Skip to content

Commit

Permalink
Add archive update task
Browse files Browse the repository at this point in the history
Closes #52
  • Loading branch information
jmelot committed Nov 15, 2024
1 parent 08f331d commit 4cccb52
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions linkage_dag.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
get_post_success,
)
from dataloader.airflow_utils.utils import clear_gcs_dir
from dataloader.scripts.clean_backups import clean_backups
from dataloader.scripts.populate_documentation import update_table_descriptions

production_dataset = "literature"
Expand Down Expand Up @@ -629,18 +630,23 @@

# We're done! Checks passed, so copy to production and post success to slack
start_production_cp = DummyOperator(task_id="start_production_cp")
update_archive = PythonOperator(
task_id="update_archive",
op_kwargs={"dataset": backup_dataset, "backup_prefix": production_dataset},
python_callable=clean_backups,
)
success_alert = get_post_success("Article linkage update succeeded!", dag)
trigger_org_fixes = TriggerDagRunOperator(
task_id="trigger_org_fixes",
trigger_dag_id="org_fixes",
)

curr_date = datetime.now().strftime("%Y%m%d")
with open(
f"{os.environ.get('DAGS_FOLDER')}/schemas/{gcs_folder}/table_descriptions.json"
) as f:
table_desc = json.loads(f.read())

trigger_org_fixes = TriggerDagRunOperator(
task_id="trigger_org_fixes",
trigger_dag_id="org_fixes",
)

for table in production_tables:
push_to_production = BigQueryToBigQueryOperator(
task_id="copy_" + table.lower(),
Expand Down Expand Up @@ -670,6 +676,7 @@
>> push_to_production
>> snapshot
>> pop_descriptions
>> update_archive
>> success_alert
>> trigger_org_fixes
)
Expand All @@ -691,7 +698,7 @@
create_disposition="CREATE_IF_NEEDED",
write_disposition="WRITE_TRUNCATE",
)
start_production_cp >> copy_cld2 >> snapshot_cld2 >> success_alert
start_production_cp >> copy_cld2 >> snapshot_cld2 >> update_archive

# task structure
clear_tmp_dir >> metadata_sequences_start
Expand Down

0 comments on commit 4cccb52

Please sign in to comment.