ashb commented on a change in pull request #7312: [AIRFLOW-6695] Add DAG run
configuration to UI
URL: https://github.com/apache/airflow/pull/7312#discussion_r375381604
##########
File path: airflow/www/views.py
##########
@@ -972,42 +972,58 @@ def delete(self):
# Upon success return to origin.
return redirect(origin)
- @expose('/trigger', methods=['POST'])
+ @expose('/trigger', methods=['POST', 'GET'])
@has_dag_access(can_dag_edit=True)
@has_access
@action_logging
@provide_session
def trigger(self, session=None):
+
dag_id = request.values.get('dag_id')
origin = request.values.get('origin') or url_for('Airflow.index')
- dag = session.query(models.DagModel).filter(models.DagModel.dag_id ==
dag_id).first()
- if not dag:
- flash("Cannot find dag {}".format(dag_id))
- return redirect(origin)
- execution_date = timezone.utcnow()
- run_id = "manual__{0}".format(execution_date.isoformat())
+ if request.method == 'GET':
+ return self.render_template(
+ 'airflow/trigger.html',
+ dag_id=dag_id,
+ origin=origin
+ )
+ else:
Review comment:
Since the GET path returns, you can drop the `else:` (and not have to touch
the rest of this method (making the diff easier to review.
----------------------------------------------------------------
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