You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "MyLong (via GitHub)" <gi...@apache.org> on 2024/04/08 02:28:31 UTC
[I] Error when Adding a new record in Dag Run [airflow]
MyLong opened a new issue, #38816:
URL: https://github.com/apache/airflow/issues/38816
### Apache Airflow version
2.9.0b2
### If "Other Airflow 2 version" selected, which one?
2.9.0rc3
### What happened?
When Add a new record in Browse-DAG Runs, if there is note exists, the system will show Ooops!
The logs are blew:
airflow-webserver_1 | [2024-04-08T02:19:22.622+0000] {app.py:1744} ERROR - Exception on /dagrun/add [GET]
airflow-webserver_1 | Traceback (most recent call last):
airflow-webserver_1 | File "/home/airflow/.local/lib/python3.12/site-packages/flask/app.py", line 2529, in wsgi_app
airflow-webserver_1 | response = self.full_dispatch_request()
airflow-webserver_1 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
airflow-webserver_1 | File "/home/airflow/.local/lib/python3.12/site-packages/flask/app.py", line 1825, in full_dispatch_request
airflow-webserver_1 | rv = self.handle_user_exception(e)
airflow-webserver_1 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
airflow-webserver_1 | File "/home/airflow/.local/lib/python3.12/site-packages/flask/app.py", line 1823, in full_dispatch_request
airflow-webserver_1 | rv = self.dispatch_request()
airflow-webserver_1 | ^^^^^^^^^^^^^^^^^^^^^^^
airflow-webserver_1 | File "/home/airflow/.local/lib/python3.12/site-packages/flask/app.py", line 1799, in dispatch_request
airflow-webserver_1 | return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)
airflow-webserver_1 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
airflow-webserver_1 | File "/home/airflow/.local/lib/python3.12/site-packages/airflow/www/decorators.py", line 159, in wrapper
airflow-webserver_1 | return f(*args, **kwargs)
airflow-webserver_1 | ^^^^^^^^^^^^^^^^^^
airflow-webserver_1 | File "/home/airflow/.local/lib/python3.12/site-packages/flask_appbuilder/security/decorators.py", line 137, in wraps
airflow-webserver_1 | return f(self, *args, **kwargs)
airflow-webserver_1 | ^^^^^^^^^^^^^^^^^^^^^^^^
airflow-webserver_1 | File "/home/airflow/.local/lib/python3.12/site-packages/flask_appbuilder/views.py", line 590, in add
airflow-webserver_1 | return self.render_template(
airflow-webserver_1 | ^^^^^^^^^^^^^^^^^^^^^
airflow-webserver_1 | File "/home/airflow/.local/lib/python3.12/site-packages/flask_appbuilder/baseviews.py", line 342, in render_template
airflow-webserver_1 | return render_template(
airflow-webserver_1 | ^^^^^^^^^^^^^^^^
airflow-webserver_1 | File "/home/airflow/.local/lib/python3.12/site-packages/flask/templating.py", line 147, in render_template
airflow-webserver_1 | return _render(app, template, context)
airflow-webserver_1 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
airflow-webserver_1 | File "/home/airflow/.local/lib/python3.12/site-packages/flask/templating.py", line 130, in _render
airflow-webserver_1 | rv = template.render(context)
airflow-webserver_1 | ^^^^^^^^^^^^^^^^^^^^^^^^
airflow-webserver_1 | File "/home/airflow/.local/lib/python3.12/site-packages/jinja2/environment.py", line 1301, in render
airflow-webserver_1 | self.environment.handle_exception()
airflow-webserver_1 | File "/home/airflow/.local/lib/python3.12/site-packages/jinja2/environment.py", line 936, in handle_exception
airflow-webserver_1 | raise rewrite_traceback_stack(source=source)
airflow-webserver_1 | File "/home/airflow/.local/lib/python3.12/site-packages/flask_appbuilder/templates/appbuilder/general/model/add.html", line 2, in top-level template code
airflow-webserver_1 | {% import 'appbuilder/general/lib.html' as lib %}
airflow-webserver_1 | ^^^^^^^^^^^^^^^^^^^^^^^^^
airflow-webserver_1 | File "/home/airflow/.local/lib/python3.12/site-packages/flask_appbuilder/templates/appbuilder/base.html", line 1, in top-level template code
airflow-webserver_1 | {% extends base_template %}
airflow-webserver_1 | ^^^^^^^^^^^^^^^^^^^^^^^^^
airflow-webserver_1 | File "/home/airflow/.local/lib/python3.12/site-packages/airflow/www/templates/airflow/main.html", line 21, in top-level template code
airflow-webserver_1 | {% from 'airflow/_messages.html' import show_message %}
airflow-webserver_1 | ^^^^^^^^^^^^^^^^^^^^^^^^^
airflow-webserver_1 | File "/home/airflow/.local/lib/python3.12/site-packages/flask_appbuilder/templates/appbuilder/baselayout.html", line 2, in top-level template code
airflow-webserver_1 | {% import 'appbuilder/baselib.html' as baselib %}
airflow-webserver_1 | ^^^^^^^^^^^^^^^^^^^^^^^^^
airflow-webserver_1 | File "/home/airflow/.local/lib/python3.12/site-packages/flask_appbuilder/templates/appbuilder/init.html", line 42, in top-level template code
airflow-webserver_1 | {% block body %}
airflow-webserver_1 | File "/home/airflow/.local/lib/python3.12/site-packages/flask_appbuilder/templates/appbuilder/baselayout.html", line 19, in block 'body'
airflow-webserver_1 | {% block content %}
airflow-webserver_1 | File "/home/airflow/.local/lib/python3.12/site-packages/flask_appbuilder/templates/appbuilder/general/model/add.html", line 7, in block 'content'
airflow-webserver_1 | {% block add_form %}
airflow-webserver_1 | File "/home/airflow/.local/lib/python3.12/site-packages/flask_appbuilder/templates/appbuilder/general/model/add.html", line 8, in block 'add_form'
airflow-webserver_1 | {{ widgets.get('add')(form_action=form_action)|safe }}
airflow-webserver_1 | ^^^^^^^^^^^^^^^^^^^^^^^^^
airflow-webserver_1 | File "/home/airflow/.local/lib/python3.12/site-packages/flask_appbuilder/widgets.py", line 37, in __call__
airflow-webserver_1 | return template.render(args)
airflow-webserver_1 | ^^^^^^^^^^^^^^^^^^^^^
airflow-webserver_1 | File "/home/airflow/.local/lib/python3.12/site-packages/jinja2/environment.py", line 1301, in render
airflow-webserver_1 | self.environment.handle_exception()
airflow-webserver_1 | File "/home/airflow/.local/lib/python3.12/site-packages/jinja2/environment.py", line 936, in handle_exception
airflow-webserver_1 | raise rewrite_traceback_stack(source=source)
airflow-webserver_1 | File "/home/airflow/.local/lib/python3.12/site-packages/flask_appbuilder/templates/appbuilder/general/widgets/form.html", line 45, in top-level template code
airflow-webserver_1 | {{ lib.render_field(field, begin_sep_label, end_sep_label, begin_sep_field, end_sep_field) }}
airflow-webserver_1 | ^^^^^^^^^^^^^^^^^^^^^^^^^
airflow-webserver_1 | File "/home/airflow/.local/lib/python3.12/site-packages/jinja2/runtime.py", line 777, in _invoke
airflow-webserver_1 | rv = self._func(*arguments)
airflow-webserver_1 | ^^^^^^^^^^^^^^^^^^^^^^
airflow-webserver_1 | File "/home/airflow/.local/lib/python3.12/site-packages/flask_appbuilder/templates/appbuilder/general/lib.html", line 251, in template
airflow-webserver_1 | {{ field(**kwargs)|safe }}
airflow-webserver_1 | ^^^^^^^^^^^^^^^^^^^^^^^^^
airflow-webserver_1 | File "/home/airflow/.local/lib/python3.12/site-packages/wtforms/fields/core.py", line 176, in __call__
airflow-webserver_1 | return self.meta.render_field(self, kwargs)
airflow-webserver_1 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
airflow-webserver_1 | File "/home/airflow/.local/lib/python3.12/site-packages/wtforms/meta.py", line 64, in render_field
airflow-webserver_1 | return field.widget(field, **render_kw)
airflow-webserver_1 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
airflow-webserver_1 | File "/home/airflow/.local/lib/python3.12/site-packages/flask_appbuilder/fieldwidgets.py", line 162, in __call__
airflow-webserver_1 | return super(Select2Widget, self).__call__(field, **kwargs)
airflow-webserver_1 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
airflow-webserver_1 | File "/home/airflow/.local/lib/python3.12/site-packages/wtforms/widgets/core.py", line 390, in __call__
airflow-webserver_1 | html.append(self.render_option(val, label, selected, **render_kw))
airflow-webserver_1 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
airflow-webserver_1 | File "/home/airflow/.local/lib/python3.12/site-packages/wtforms/widgets/core.py", line 403, in render_option
airflow-webserver_1 | return Markup(f"<option {html_params(**options)}>{escape(label)}</option>")
airflow-webserver_1 | ^^^^^^^^^^^^^
airflow-webserver_1 | File "/home/airflow/.local/lib/python3.12/site-packages/airflow/models/dagrun.py", line 1651, in __repr__
airflow-webserver_1 | prefix = f"<{self.__class__.__name__}: {self.dag_id}.{self.dagrun_id} {self.run_id}"
airflow-webserver_1 | ^^^^^^^^^^^
airflow-webserver_1 | AttributeError: 'DagRunNote' object has no attribute 'dag_id'
### What you think should happen instead?
_No response_
### How to reproduce
1. add a note to arbitrary DAG Run in Dag Run details.

2. Browse->DAG Runs, click the plus button to add a new record

3. you will see the ooops
### Operating System
Ubuntu 22.04 LTS
### Versions of Apache Airflow Providers
_No response_
### Deployment
Docker-Compose
### Deployment details
docker-compose version 1.29.2
### Anything else?
seems the \_\_repr\_\_ function uses the wrong field key.
```
class DagRunNote(Base):
__tablename__ = "dag_run_note"
user_id = Column(
Integer,
ForeignKey("ab_user.id", name="dag_run_note_user_fkey"),
nullable=True,
)
dag_run_id = Column(Integer, primary_key=True, nullable=False)
content = Column(String(1000).with_variant(Text(1000), "mysql"))
created_at = Column(UtcDateTime, default=timezone.utcnow, nullable=False)
updated_at = Column(UtcDateTime, default=timezone.utcnow, onupdate=timezone.utcnow, nullable=False)
dag_run = relationship("DagRun", back_populates="dag_run_note")
__table_args__ = (
PrimaryKeyConstraint("dag_run_id", name="dag_run_note_pkey"),
ForeignKeyConstraint(
(dag_run_id,),
["dag_run.id"],
name="dag_run_note_dr_fkey",
ondelete="CASCADE",
),
)
def __init__(self, content, user_id=None):
self.content = content
self.user_id = user_id
def __repr__(self):
prefix = f"<{self.__class__.__name__}: {self.dag_id}.{self.dagrun_id} {self.run_id}"
if self.map_index != -1:
prefix += f" map_index={self.map_index}"
return prefix + ">"
```
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://github.com/apache/airflow/blob/main/CODE_OF_CONDUCT.md)
--
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.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] Error when Adding a new record in Dag Run [airflow]
Posted by "boring-cyborg[bot] (via GitHub)" <gi...@apache.org>.
boring-cyborg[bot] commented on issue #38816:
URL: https://github.com/apache/airflow/issues/38816#issuecomment-2041753950
Thanks for opening your first issue here! Be sure to follow the issue template! If you are willing to raise PR to address this issue please do so, no need to wait for approval.
--
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.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] Error when Adding a new record in Dag Run [airflow]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] closed issue #38816: Error when Adding a new record in Dag Run
URL: https://github.com/apache/airflow/issues/38816
--
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.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] Error when Adding a new record in Dag Run [airflow]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on issue #38816:
URL: https://github.com/apache/airflow/issues/38816#issuecomment-2796028465
This issue has been automatically marked as stale because it has been open for 365 days without any activity. There has been several Airflow releases since last activity on this issue. Kindly asking to recheck the report against latest Airflow version and let us know if the issue is reproducible. The issue will be closed in next 30 days if no further activity occurs from the issue author.
--
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.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] Error when Adding a new record in Dag Run [airflow]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on issue #38816:
URL: https://github.com/apache/airflow/issues/38816#issuecomment-2869543276
This issue has been closed because it has not received response from the issue author.
--
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.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org