-
Notifications
You must be signed in to change notification settings - Fork 0
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 #34 from Ferlab-Ste-Justine/main
Update dags prod
- Loading branch information
Showing
22 changed files
with
499 additions
and
230 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
This file was deleted.
Oops, something went wrong.
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
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,75 @@ | ||
from datetime import datetime | ||
|
||
from airflow import DAG | ||
from airflow.models.param import Param | ||
from airflow.operators.empty import EmptyOperator | ||
from airflow.utils.task_group import TaskGroup | ||
|
||
from es_templates_update import es_templates_update | ||
from etl_enrich_specimens import etl_enrich_specimens | ||
from etl_enrich_variants import variant_task_enrich_variants, variant_task_enrich_consequences | ||
from etl_index_variants import index_variants | ||
from etl_normalize_variants import extract_params, normalized_etl | ||
from etl_prepare_index_variants import etl_variant_prepared | ||
from etl_publish_variants import publish_task | ||
from lib.slack import Slack | ||
|
||
with DAG( | ||
dag_id='etl-variant', | ||
start_date=datetime(2022, 1, 1), | ||
schedule_interval=None, | ||
# concurrency set to 1, only one task can run at a time to avoid conflicts in Delta table | ||
concurrency=1, | ||
params={ | ||
'study_code': Param('CAG', type='string'), | ||
'owner': Param('jmichaud', type='string'), | ||
'dateset_batches': Param( | ||
[ | ||
{'dataset': 'dataset_dataset1', 'batches': ['annotated_vcf1','annotated_vcf2']}, | ||
{'dataset': 'dataset_dataset2', 'batches': ['annotated_vcf']} | ||
], | ||
schema = { | ||
"type": "array", | ||
"minItems": 1, | ||
"items": { | ||
"type": "object", | ||
"default": {'dataset': 'dataset_default', 'batches': ['annotated_vcf']}, | ||
"properties": { | ||
"dataset": {"type": "string"}, | ||
"batches": {"type": "array", "items": {"type": "string"}}, | ||
}, | ||
"required": ["dataset", "batches"] | ||
}, | ||
} | ||
), | ||
'release_id': Param('7', type='string'), | ||
'project': Param('cqdg', type='string'), | ||
'es_port': Param('9200', type='string'), | ||
}, | ||
) as dag: | ||
params = extract_params() | ||
|
||
with TaskGroup(group_id='normalize') as normalize: | ||
normalized_etl(run_time_params = params, name='snv') >> normalized_etl(run_time_params = params, name='consequences') | ||
|
||
with TaskGroup(group_id='enrich') as enrich: | ||
variant_task_enrich_variants() >> variant_task_enrich_consequences() | ||
|
||
with TaskGroup(group_id='prepared') as prepared: | ||
etl_variant_prepared('variant_centric') >> etl_variant_prepared('gene_centric') >> etl_variant_prepared('variant_suggestions') >> etl_variant_prepared('gene_suggestions') | ||
|
||
with TaskGroup(group_id='index') as index: | ||
index_variants() | ||
|
||
start = EmptyOperator( | ||
task_id="start", | ||
on_success_callback=Slack.notify_dag_start | ||
) | ||
|
||
slack = EmptyOperator( | ||
task_id="slack", | ||
on_success_callback=Slack.notify_dag_completion | ||
) | ||
|
||
|
||
start >> etl_enrich_specimens() >> normalize >> enrich >> prepared >> es_templates_update() >> index >> publish_task('variant_centric,variant_suggestions,gene_centric,gene_suggestions') >> slack |
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
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
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 |
---|---|---|
@@ -1,32 +1,36 @@ | ||
from datetime import datetime | ||
|
||
from airflow import DAG | ||
from airflow.models.param import Param | ||
from datetime import datetime | ||
|
||
from lib.config import etl_variant_config, default_config_file | ||
from lib.operators.spark import SparkOperator | ||
from lib.slack import Slack | ||
|
||
etl_variant_enrich_config = etl_variant_config \ | ||
.with_spark_class('bio.ferlab.etl.enriched.RunEnrichGenomic') \ | ||
.args('--config', default_config_file, | ||
'--steps', 'default' | ||
) | ||
with DAG( | ||
dag_id='etl-enrich-variants', | ||
start_date=datetime(2022, 1, 1), | ||
schedule_interval=None, | ||
params={ | ||
'project': Param('cqdg', type='string'), | ||
}, | ||
) as dag: | ||
|
||
variant_task_enrich_variants = etl_variant_enrich_config.prepend_args('variants').operator( | ||
def variant_task_enrich_variants(): | ||
return etl_variant_enrich_config.prepend_args('variants').operator( | ||
task_id='variant_task_variant_enrich_variants', | ||
name='etl-variant_task_variant_enrich_variants' | ||
) | ||
|
||
variant_task_enrich_consequences = etl_variant_enrich_config.prepend_args('consequences').operator( | ||
def variant_task_enrich_consequences(): | ||
return etl_variant_enrich_config.prepend_args('consequences').operator( | ||
task_id='variant_task_variant_enrich_consequences', | ||
name='etl-variant_task_variant_enrich_consequences' | ||
) | ||
|
||
|
||
variant_task_enrich_variants >> variant_task_enrich_consequences | ||
with DAG( | ||
dag_id='etl-enrich-variants', | ||
start_date=datetime(2022, 1, 1), | ||
schedule_interval=None, | ||
params={ | ||
'project': Param('cqdg', type='string'), | ||
}, | ||
on_failure_callback=Slack.notify_task_failure | ||
) as dag: | ||
variant_task_enrich_variants() >> variant_task_enrich_consequences() |
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
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
Oops, something went wrong.