-
Notifications
You must be signed in to change notification settings - Fork 14.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Help using TriggerDagRunOperator #1001
Comments
Something is wrong in the documentation: From documentation: From test case:
|
Hi @pedrorjbr, I put together an example to help you. There are some gotcha's however that tripped me up:
Illustrative Example:
Step 2 : Define your Controller DAG with any interval that makes sense for you! It's going to be checking a condition on that interval and triggering the Target DAG whenever the condition is met. In the example below, I am running it every minute and always executing the trigger. The idea of the
Optional Step 3 : You can also manually trigger your Target DAG using the CLI, perhaps when testing or if you are using some custom automation via Your DAG_Run table will look like : You can see 3 types of entries (from top to bottom):
The documentation sucks. Please do your part and update it as and when questions are answered. I can do this one. Closing for now, but ping me here or on gitter if you need it reopened. |
@r39132: Thanks again for the response. I will update the documentation. Do you have any example how can I pass information from a dag to a triggered dag? How I get the information on the triggered dag? |
Good question. Reopening questions and I now understand the other issue that you opened. Post the question on gitter - I know @nicktrav is doing something with triggering subdags. That might hold a solution. I'll investigate as well later tonight, |
http://pythonhosted.org/airflow/code.html#airflow.operators.TriggerDagRunOperator
You can refer to the code |
Thanks! @mistercrunch But how can I get the pickable object in the triggered dag? Is it a property of the DAG or Task? Can you post a sample of code. Sorry, maybe it is a noob question. From DOC: |
Here you go: If this meets your needs, close the issue. Else, please ping me on gitter.. email tends to get lost. If I don't hear back in a day, I'll assume the issue closed |
Closing. If you have any questions, add them here and ping me on gitter and I can reopen. |
I am getting in kwargs, and cannot get the conf value... {u'dag_run': None, u'run_id': None, u'dag': <DAG: test_trigger>, u'conf': <module 'airflow.configuration' from '/usr/local/lib/python2.7/dist-packages/airflow/configuration.pyc'>, u'tables': None, u'task_instance_key_str': u'test_trigger__run_this__20160220', u'END_DATE': '2016-02-20', u'execution_date': datetime.datetime(2016, 2, 20, 12, 45, 36), u'ts': '2016-02-20T12:45:36', u'macros': <module 'airflow.macros' from '/usr/local/lib/python2.7/dist-packages/airflow/macros/init.pyc'>, u'params': {}, u'ti': <TaskInstance: test_trigger.run_this 2016-02-20 12:45:36 [running]>, u'ds_nodash': u'20160220', u'test_mode': False, u'end_date': '2016-02-20', 'templates_dict': None, u'task': <Task(PythonOperator): run_this>, u'task_instance': <TaskInstance: test_trigger.run_this 2016-02-20 12:45:36 [running]>, u'latest_date': '2016-02-20', u'yesterday_ds': '2016-02-19', u'ts_nodash': u'20160220T124536', u'tomorrow_ds': '2016-02-21'} |
Let's keep the conversation in a single issue. Let's keep the conversation in #1029 I'll change that title to be the same as this one 'Help using TriggerDagRunOperator' |
I running into problems use the TriggerDagRunOperator:
Does anyone can write a sample code for the
def foo(context, dag_run_obj):
function?The text was updated successfully, but these errors were encountered: