ashb commented on a change in pull request #4868: [AIRFLOW-3836] Remove DagBag
from /run
URL: https://github.com/apache/airflow/pull/4868#discussion_r263771484
##########
File path: airflow/www/views.py
##########
@@ -752,18 +752,22 @@ def xcom(self, session=None):
@has_access
@action_logging
def run(self):
+ """Trigger a run of a task, starting a task instance."""
dag_id = request.args.get('dag_id')
task_id = request.args.get('task_id')
origin = request.args.get('origin')
- dag = dagbag.get_dag(dag_id)
- task = dag.get_task(task_id)
-
execution_date = request.args.get('execution_date')
- execution_date = pendulum.parse(execution_date)
ignore_all_deps = request.args.get('ignore_all_deps') == "true"
ignore_task_deps = request.args.get('ignore_task_deps') == "true"
ignore_ti_state = request.args.get('ignore_ti_state') == "true"
+ dag_model = DagModel.get_dagmodel(dag_id)
+ if not dag_model:
+ flash("DAG '{0}' not found.".format(dag_id), "error")
+ return redirect("/")
Review comment:
Eek. This is wrong (including in all the other ones we've already merged.).
We shouldn't be hard-coding URLs as it will be wrong if base_url is specified.
`url_for('Airflow.index')`
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services