Skip to content

Commit

Permalink
Return only the dag_id
Browse files Browse the repository at this point in the history
Co-authored-by: Tzu-ping Chung <uranusjr@gmail.com>
  • Loading branch information
Taragolis and uranusjr committed Apr 11, 2024
1 parent 6b06eb3 commit cc4b75c
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions airflow/www/security_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,8 +199,8 @@ def get_dag_id_from_task_instance(resource_pk):
if not resource_pk:
return None
composite_pk = json.loads(resource_pk)
ti = session.scalar(
select(TaskInstance)
dag_id = session.scalar(
select(TaskInstance.dag_id)
.where(
TaskInstance.dag_id == composite_pk[0],
TaskInstance.task_id == composite_pk[1],
Expand All @@ -209,9 +209,9 @@ def get_dag_id_from_task_instance(resource_pk):
)
.limit(1)
)
if not ti:
if not dag_id:
raise AirflowException("Task instance not found")
return ti.dag_id
return dag_id

def get_pool_name(resource_pk):
if not resource_pk:
Expand Down

0 comments on commit cc4b75c

Please sign in to comment.