question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

JiraTicketSensor duplicates TaskId

See original GitHub issue

Apache Airflow Provider(s)

jira

Versions of Apache Airflow Providers

apache-airflow-providers-jira==2.0.1

Apache Airflow version

2.2.2

Operating System

Amazon Linux 2

Deployment

MWAA

Deployment details

No response

What happened

I’ve been trying to use the Jira Operator to create a Ticket from Airflow and use the JiraTicketSensor to check if the ticket was resolved. Creating the task works fine, but I can’t get the Sensor to work.

If I don’t provide the method_name I get an error that it is required, if I provide it as None, I get an error saying the Task id has already been added to the DAG.

Broken DAG: [/usr/local/airflow/dags/jira_ticket_sensor.py] Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/airflow/models/baseoperator.py", line 553, in __init__
    task_group.add(self)
  File "/usr/local/lib/python3.7/site-packages/airflow/utils/task_group.py", line 175, in add
    raise DuplicateTaskIdFound(f"Task id '{key}' has already been added to the DAG")
airflow.exceptions.DuplicateTaskIdFound: Task id 'jira_sensor' has already been added to the DAG

What you think should happen instead

No response

How to reproduce

use this dag

from datetime import datetime

from airflow import DAG
from airflow.providers.jira.sensors.jira import JiraTicketSensor

with DAG(
    dag_id='jira_ticket_sensor',
    schedule_interval=None,
    start_date=datetime(2021, 1, 1),
    catchup=False
) as dag:
    jira_sensor = JiraTicketSensor(
        task_id='jira_sensor',
        jira_conn_id='jira_default',
        ticket_id='TEST-1',
        field='status',
        expected_value='Completed',
        method_name='issue',
        poke_interval=600
    )

Anything else

This error occurs every time

Are you willing to submit PR?

  • Yes I am willing to submit a PR!

Code of Conduct

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
kianelbocommented, Apr 29, 2022

I’m embarrassed… I hope https://github.com/apache/airflow/pull/23352 does the trick.

I see two ways to fix it

I decided to go with the second solution since github sensor and arangodb operator are written in a similar way.

1reaction
kianelbocommented, Apr 15, 2022

I opened a PR according to what @potiuk explained. This is my first ever contribution and I would really appreciate it if you take a look at it and give your feedbacks.

Read more comments on GitHub >

github_iconTop Results From Across the Web

No results found

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found