Skip to content

Commit

Permalink
Fix bug in trigerring dag if it wasn't read yet
Browse files Browse the repository at this point in the history
  • Loading branch information
michael-kotliar committed Sep 4, 2019
1 parent eadad47 commit bd14142
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion cwl_airflow/wes/backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,20 @@ def post_dag_runs_legacy(self, dag_id):


def trigger_dag(self, dag_id, run_id, conf):
return trigger_dag.trigger_dag(dag_id=dag_id, run_id=run_id, conf=conf, replace_microseconds=False)
try:
dag_path = DagModel.get_current(dag_id).fileloc
except Exception:
dag_path = path.join(DAGS_FOLDER, dag_id + ".py")
triggers = trigger_dag._trigger_dag(
dag_id=dag_id,
dag_run=DagRun(),
dag_bag=DagBag(dag_folder=dag_path),
run_id=run_id,
conf=conf,
execution_date=None,
replace_microseconds=False
)
return triggers[0] if triggers else None


def list_dags(self):
Expand Down

0 comments on commit bd14142

Please sign in to comment.