Created
June 27, 2020 11:46
-
-
Save theone4ever/38c498b1acfeb4e64f10d0bebc80b6c5 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| import pandas as pd | |
| def prep_data(input_param): | |
| df = pd.read_parquet(input_param['input_data'] | |
| return df | |
This file contains hidden or 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
| default_args = { | |
| 'owner': 'airflow', | |
| 'depends_on_past': False, | |
| 'start_date': days_ago(2), | |
| 'email': ['[email protected]'], | |
| 'email_on_failure': False, | |
| 'email_on_retry': False, | |
| 'retries': 1, | |
| 'retry_delay': timedelta(minutes=5), | |
| } | |
| training_dag = DAG( | |
| 'my_training_dag', | |
| default_args=default_args, | |
| description='A simple tutorial DAG', | |
| schedule_interval=timedelta(days=1), | |
| ) | |
| input_param = {'input_data':'/tmp/1.parquet'} | |
| with training_dag as dag: | |
| # First data preparation task | |
| prep_data = PythonOperator( | |
| task_id="prep_data", | |
| python_callable=prep_data.prep_data, | |
| op_kwargs=training_config, | |
| provide_context=True | |
| ) | |
| #Second model training task | |
| training_model = PythonOperator( | |
| task_id="prep_data", | |
| python_callable=tasks.prep_data, | |
| op_kwargs=input_param, | |
| provide_context=True | |
| ) | |
| [prep_data, training_model] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment