Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ExternalTaskSensor fails with ValueError on state comparison #12552

Closed
BasPH opened this issue Nov 22, 2020 · 5 comments
Closed

ExternalTaskSensor fails with ValueError on state comparison #12552

BasPH opened this issue Nov 22, 2020 · 5 comments
Assignees
Labels
affected_version:2.0 Issues Reported for 2.0 kind:bug This is a clearly a bug pending-response priority:critical Showstopper bug that should be patched immediately

Comments

@BasPH
Copy link
Contributor

BasPH commented Nov 22, 2020

Apache Airflow version:
2.0.0b3 (Docker)

Kubernetes version (if you are using kubernetes) (use kubectl version):
N/A

Environment:
Airflow 2.0 beta3 with Docker Compose

  • Cloud provider or hardware configuration:
  • OS (e.g. from /etc/os-release):
  • Kernel (e.g. uname -a):
  • Install tools:
  • Others:

What happened:
This task fails the DAG import:

ExternalTaskSensor(
        task_id="wait_for_etl_dag3",
        external_dag_id="figure_6_19_dag_3",
        external_task_id="etl",
        dag=dag4,
        allowed_states=State.task_states,
    ),

Error:

Broken DAG: [/opt/airflow/dags/figure_6_19.py] Traceback (most recent call last):
  File "/home/airflow/.local/lib/python3.8/site-packages/airflow/utils/decorators.py", line 94, in wrapper
    result = func(*args, **kwargs)
  File "/home/airflow/.local/lib/python3.8/site-packages/airflow/sensors/external_task_sensor.py", line 118, in __init__
    raise ValueError(
ValueError: Valid values for `allowed_states` and `failed_states` when `external_task_id` is not `None`: ('success', 'running', 'failed', 'upstream_failed', 'skipped', 'up_for_retry', 'up_for_reschedule', 'queued', None, 'scheduled', 'sensing')

It appears the check on line 118 holds the following value:

{('success', 'running', 'failed', 'upstream_failed', 'skipped', 'up_for_retry', 'up_for_reschedule', 'queued', None, 'scheduled', 'sensing')}

And State.task_states holds this value:

('success', 'running', 'failed', 'upstream_failed', 'skipped', 'up_for_retry', 'up_for_reschedule', 'queued', None, 'scheduled', 'sensing')

Which fails this check:

if not total_states <= set(State.task_states):

What you expected to happen:
No failure. Probably some type conversion issue, reporting the issue now and diving into the code.

How to reproduce it:

Anything else we need to know:

@BasPH BasPH added the kind:bug This is a clearly a bug label Nov 22, 2020
@ashb ashb added this to the Airflow 2.0.0-beta4 milestone Nov 24, 2020
@ashb ashb added the priority:critical Showstopper bug that should be patched immediately label Nov 25, 2020
@vikramkoka
Copy link
Contributor

@jhtimmins I think you are working on this, correct?

@jhtimmins
Copy link
Contributor

@vikramkoka I'm assigned but have not yet started. Will be starting tomorrow.

@ashb
Copy link
Member

ashb commented Dec 3, 2020

@BasPH I think your example has a copy-paste error -- I don't get the error you showed, unless I pass allowed_states=[State.task_states]

@ashb
Copy link
Member

ashb commented Dec 3, 2020

A different error we found investigating this was fixed in #12794 - but the original error seems valid - you appear to have passed a list containing a tuple, rather than the tuple directly.

@vikramkoka vikramkoka added the affected_version:2.0 Issues Reported for 2.0 label Dec 4, 2020
@ashb
Copy link
Member

ashb commented Dec 4, 2020

Closing this as we think we've fixed one problem (and the original error was valid -- it was invalid.) Please re-open if there's more info/you think we're wrong.

@ashb ashb closed this as completed Dec 4, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
affected_version:2.0 Issues Reported for 2.0 kind:bug This is a clearly a bug pending-response priority:critical Showstopper bug that should be patched immediately
Projects
None yet
Development

No branches or pull requests

5 participants
  翻译: