-
Notifications
You must be signed in to change notification settings - Fork 16.3k
Add description field to connection (#10840) #10873
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
Conversation
airflow/models/connection.py
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you explain it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rule R0913 of pylint expected functions and methods to have utmost 10 arguments. The __init__ method of Connection class already had 10 arguments. I added description which made it 11. So, had to disable rule R0913 and I followed the convention here.
Would it be better to replace # pylint: disable=R0913 with #pylint: disable=too-many-arguments and add it at the end of the line class Connection(Base, LoggingMixin): instead of disabling the rule for the whole file?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it be better to replace # pylint: disable=R0913 with #pylint: disable=too-many-arguments and add it at the end of the line class Connection(Base, LoggingMixin):
That would be preferable as others will know what exactly is disabled
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done :) Added #pylint: disable=too-many-arguments to __init__ method of Connection class.
|
For me this looks good just one comment 👌 |
|
@kaxil waiting for your review 🙂 |
|
Can this be added to Airflow 1.10.13 milestone? |
|
@abhilash1in -> this one looks like more of a convenience than an important change and we actually only cherry-pick to 1.10* what is absolutely necessary. We are getting closer to 2.0 release and we also need to have some "nice features" in 2.0 to get people more excited to migrate to it ;). Also we have two versions of the UI in 1.10 and if we add it to the DB we would have to also add it to both UIs. Plus we also have connection retrieval from the secret backends, so I guess @kaxil's review will point it out that we will have to add similar capabilities to secret backends. I think it's far too little gain and far too much complexity to try to cherry-pick that one. |
|
@potiuk that makes sense, thank you. I'm okay with this being added to 2.0. |
kaxil
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tests are failing
@kaxil There were two alembic heads since a new migration was pushed to master after I created my migration (both had the same I've added a new commit to merge the alembic heads and rebased my fork to be in sync with master. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's update the other migration in place since this PR is not merged instead of merging the heads
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done. Waiting for the tests to finish running.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kaxil some checks were skipped although nothing else failed, not sure why.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kaxil can you please review? Would be great if we can close this soon.
Descriptions are only useful in the Web UI, and connections from the secret backends are not visible in Airflow, so it is not necessary to add support for this field in the backend secret. |
Recently there was a discussion about showing the "names" but not "values" of the connections - so that we can see the connections in the UI even if they are coming from the secret backend. I think for 2.0 we should consciously decide what we do with the connection coming from the secrets and potentially show them in the UI. Otherwise it might be very misleading - the user sees a different "reality" than is "viewed" by the workers. I believe if we want to add a new "property" of connection - it is very much related to what we are going to do with displaying them in UI (including secret backends) WDYT @mik-laj - is it good that we do not see secret backend connection, and when we have the connection in db, we see a wrong one ? I think it's rather bad and might be super-confusing for the user. That's why I think we should first decide what we want to do with the connections and later think about adding new properties to them. |
|
@potiuk I'm eager to talk about the mailing list, but in my opinion displaying the item list is a significant extension of the backend secret concept. During its development, the topic of the web UI was discussed and it was decided that the backend secret is just a single interface with the
This is confusing, and I agree that it is worth warning users about the consequences of configuring the backend secret. I think the warning "Your administrator has set up a secret backend. The data displayed in the Web UI may not represent the state available for the workers". I am afraid that reading any of the values by the webserver can be problematic in corporate environments as corporate environments have a very strict secret access policy. The most common environments I take care of are deployed consisting of several GCP projects. The webserver is in a project that cannot activate the API or access it at all. Recently, I even had to deal with a issues related to it. In one case, the webserver still tried to make connections to the backend secret, but it never succeeded. |
|
@abhilash1in It'd be great if you could add this same field for Variables. |
|
@turbaszek @kaxil @potiuk @mik-laj Can someone please review and close this PR? |
|
@kaxil do you think this PR requires changes to the secret backend? as I think the backends are working now, the additional columns have no effect and there is no obstacle to merging this change. |
Yup, it will continue to work |
|
Rebased the PR to the latest master, will merge as soon as CI is green |
|
One tests failed: |
|
Rebased to the latest master. |
|
I also rebased to latest master. |
|
The Workflow run is cancelling this PR. It has some failed jobs matching ^Pylint$,^Static checks$,^Build docs$,^Spell check docs$,^Backport packages$,^Checks: Helm tests$,^Test OpenAPI*. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| Revises: bef4f3d11e8b | |
| Revises: 98271e7606e2 |
|
This will be very helpful! |
|
@abhilash1in Can you do a rebase? |
On it. Resolving merge conflicts. Should be done soon. |
|
You might also have to update alembic revision ids |
|
The Workflow run is cancelling this PR. It has some failed jobs matching ^Pylint$,^Static checks,^Build docs$,^Spell check docs$,^Backport packages$,^Provider packages,^Checks: Helm tests$,^Test OpenAPI*. |
|
@kaxil @mik-laj can you please take a look at the failing workflow? Not sure why there is an error |
|
@abhilash1in Please ignore it. This is just a transistent problem. This should be fixed soon. |
Summary:
Add a description (string) field to store additional details about a connection.
UI:
CLI:
related: #10840
^ Add meaningful description above
Read the Pull Request Guidelines for more information.
In case of fundamental code change, Airflow Improvement Proposal (AIP) is needed.
In case of a new dependency, check compliance with the ASF 3rd Party License Policy.
In case of backwards incompatible changes please leave a note in UPDATING.md.