Skip to content

Conversation

@milton0825
Copy link
Contributor

@milton0825 milton0825 commented Apr 14, 2019

Make sure you have checked all steps below.

Jira

Description

  • Here are some details about my PR, including screenshots of any UI changes:

A way to register global operator extra link that is available for all the operators through airflow plugin.

Screen Shot 2019-04-11 at 11 45 54 PM

Tests

  • My PR adds the following unit tests OR does not need testing for this extremely good reason:

Commits

  • My commits all reference Jira issues in their subject lines, and I have squashed multiple commits if they address the same issue. In addition, my commits follow the guidelines from "How to write a good git commit message":
    1. Subject is separated from body by a blank line
    2. Subject is limited to 50 characters (not including Jira issue reference)
    3. Subject does not end with a period
    4. Subject uses the imperative mood ("add", not "adding")
    5. Body wraps at 72 characters
    6. Body explains "what" and "why", not "how"

Documentation

  • In case of new functionality, my PR adds documentation that describes how to use it.
    • All the public functions and the classes in the PR contain docstrings that explain what it does
    • If you implement backwards incompatible changes, please leave a note in the Updating.md so we can assign it to a appropriate release

Code Quality

  • Passes flake8

@milton0825 milton0825 changed the title Global extra links [AIRFLOW-4306] Global operator extra links Apr 14, 2019
@milton0825 milton0825 changed the title [AIRFLOW-4306] Global operator extra links [AIRFLOW-4306][WIP] Global operator extra links Apr 14, 2019
@milton0825 milton0825 changed the title [AIRFLOW-4306][WIP] Global operator extra links [AIRFLOW-4306] Global operator extra links Apr 14, 2019
@Fokko
Copy link
Contributor

Fokko commented Apr 14, 2019

Why would we need this? Can you give some examples or actual useful links that you would register here? I feel like that there are already too many buttons in the dialog.

@codecov-io
Copy link

codecov-io commented Apr 14, 2019

Codecov Report

Merging #5094 into master will increase coverage by <.01%.
The diff coverage is 95.23%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #5094      +/-   ##
==========================================
+ Coverage   78.46%   78.47%   +<.01%     
==========================================
  Files         467      467              
  Lines       29766    29782      +16     
==========================================
+ Hits        23357    23372      +15     
- Misses       6409     6410       +1
Impacted Files Coverage Δ
airflow/hooks/hive_hooks.py 74.93% <ø> (ø) ⬆️
airflow/contrib/operators/databricks_operator.py 90.51% <ø> (ø) ⬆️
airflow/plugins_manager.py 86.91% <100%> (+0.5%) ⬆️
airflow/contrib/operators/qubole_operator.py 87.03% <100%> (+0.24%) ⬆️
airflow/models/baseoperator.py 93.93% <92.85%> (-0.1%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 603d02a...72793a9. Read the comment docs.

@milton0825
Copy link
Contributor Author

milton0825 commented Apr 14, 2019

@Fokko I think it is up to the users to decide whether they need to add these extra links. One use case at Lyft is to add extra links to task logs in Kibana/Elastic search and we probably will add links to task logs that are archived in S3. Therefore we need a way other than #5059 to register operator extra links at global level.

@milton0825
Copy link
Contributor Author

PTAL @feng-tao @ashb

@milton0825
Copy link
Contributor Author

PTAL @XD-DENG @Fokko

@feluelle
Copy link
Member

I think it's a nice idea and can be kind of useful in some cases but I think I agree more with @Fokko.

@milton0825
Copy link
Contributor Author

milton0825 commented Apr 18, 2019

@Fokko @feluelle
I am not too concerned that there will be too many buttons in the dialog UI. It is up to the user to decide whether they want to add more buttons. If the user thinks that they don't want those buttons, they simply don't register any. I would rather provide the more flexibility to the users than limit it.

Would like to hear more about the reason behind that against such flexibility.

@feng-tao
Copy link
Member

@Fokko @feluelle , I agree with @milton0825 that it would be good to provide the flexibility instead limiting that. In fact we have been running this feature at Lyft in production for long time(https://eng.lyft.com/running-apache-airflow-at-lyft-6e53bb8fccff). E.g one use case could be make the kibana log url for all the operators as kibana log searching is much easier to look at the Airflow log.

@milton0825 milton0825 force-pushed the global-extra-links branch 3 times, most recently from cd15d9a to 8be6532 Compare April 20, 2019 02:19
@milton0825
Copy link
Contributor Author

@feng-tao
Copy link
Member

@Fokko , @feluelle happy to address any other concerns you guys have. Let us know.

@milton0825
Copy link
Contributor Author

@Fokko @feluelle let us know if you have any concerns~

@feluelle
Copy link
Member

@milton0825 @feng-tao actually I didn't know that we already had #5059 in.

I am not too concerned that there will be too many buttons in the dialog UI. It is up to the user to decide whether they want to add more buttons. If the user thinks that they don't want those buttons, they simply don't register any. I would rather provide the more flexibility to the users than limit it.

Thanks Chao-Han. I absolutly agree. I also have thought about that feature once again and you convinced me. Please count my vote as +1 now.

The only issue I still have is the right location for those buttons. I think there could be a better dialog window for those buttons. Maybe we add one dialog window for operator options where we could then place those like we have for task instances.

@feng-tao
Copy link
Member

feng-tao commented Apr 22, 2019

thanks @feluelle . @Fokko , let us know if you still have concern, @milton0825 , I will take a closer look at the actual implementation tonight.

Copy link
Member

@feng-tao feng-tao left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

code lgtm, but just minor nits on make it more obvious for users on why or when they should use this feature. Let's also wait for Fokko's input.

@kunalyogenshah
Copy link
Contributor

Quick question about this implementation. Could you help provide an example usage for let's say Kibana logs that require arguments to be passed to it. For example, if I want to add a global Kibana link for all tasks, I need to be able to specify something like a log ID to the URL to redirect to the right place. Does this implementation allow that?

@milton0825
Copy link
Contributor Author

@kunalyogenshah so currently the operator instance and the execution_time are exposed to you like in: https://github.com/apache/airflow/pull/5094/files#diff-2fdb519812514e29589938d977d68ea0R94 and you should have the information (dag_id, task_id,...) to formulate the URL with granularity to each task_instance. If you need information such as log id that is out of the scope of airflow, you can do whatever you need in the get_link to get that information.

@kunalyogenshah
Copy link
Contributor

@milton0825 Got it. Constructing it this way is certainly doable. But somehow it does seem like introducing the Kibana log URLs in a more central way like the Download log links / View log links could be more semantically appropriate than adding them through global extra links? Specially if you consider adding try number to the mix, in which case a Kibana global should return multi-links instead of one link. Just a thought. + @KevinYang21

@KevinYang21
Copy link
Member

Nice idea to make it pluggable. We do also have the need to put a Kibana link on the dialog but as @kunalyogenshah mentioned, for task logs I think it makes more sense to provide different links for different try_number. Possible that we can make it so flexible that we can have plugin section just like the download log section?

@milton0825
Copy link
Contributor Author

milton0825 commented Apr 24, 2019

@KevinYang21 @kunalyogenshah I think it totally make sense to include the try-number into the scope.

I am thinking about addressing that in a separate PR to limit the scope of changes in this PR and here is the jira to track that: https://issues.apache.org/jira/browse/AIRFLOW-4398

@feng-tao
Copy link
Member

@milton0825 , is there a reason we don't make all the fields available(https://github.com/apache/airflow/blob/master/airflow/models/taskinstance.py#L126-L144) or at least most of the fields? I would imagine that adding pool / priority_weight to the task will be useful as well.

@milton0825
Copy link
Contributor Author

@KevinYang21
Copy link
Member

KevinYang21 commented Apr 24, 2019

@feng-tao Took a quick look at the code and I think that's because we start to construct the links from operator instead of from task instance. But since we already have the execution_date we can always construct the TI just like other endpoints and use whatever info is inside.

While getting the TI fields is easy, my thinking is still more on the form of the link. The fact that we can just construct a link button right now is probly not going to look very nice when we need some other format, like when we want the download log look for our kibana log links.

EDIT: (hit comment button too soon) I'm not trying to scope out this PR, I think there might be use cases that a link button is enough. If it is not trivial to create such a framework for more complex pluggable components in the dialog it makes sense to start another PR around that.

@feng-tao
Copy link
Member

feng-tao commented Apr 24, 2019

yeah, FORM/Design/UI is always a tough question....

BTW @KevinYang21 , is [email protected] your email ?

@KevinYang21
Copy link
Member

@feng-tao yes it is.

@feng-tao
Copy link
Member

@KevinYang21 , not sure how to DM you, but you may want to check your email :)

@milton0825
Copy link
Contributor Author

milton0825 commented Apr 24, 2019

Copy link
Member

@feng-tao feng-tao left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@milton0825 milton0825 force-pushed the global-extra-links branch 4 times, most recently from 3c311d1 to 6d0b0a2 Compare April 25, 2019 06:05
@milton0825
Copy link
Contributor Author

@Fokko let us know if you have any other concerns.

Provide a way to register global operator extra
links through airflow plugins.
@feng-tao feng-tao merged commit d333ffa into apache:master Apr 25, 2019
@milton0825 milton0825 deleted the global-extra-links branch April 25, 2019 22:40
ashb pushed a commit to ashb/airflow that referenced this pull request Jun 20, 2019
Provide a way to register global operator extra
links through airflow plugins.

(cherry picked from commit d333ffa)
andriisoldatenko pushed a commit to andriisoldatenko/airflow that referenced this pull request Jul 26, 2019
Provide a way to register global operator extra
links through airflow plugins.
wmorris75 pushed a commit to modmed-external/incubator-airflow that referenced this pull request Jul 29, 2019
Provide a way to register global operator extra
links through airflow plugins.
dharamsk pushed a commit to postmates/airflow that referenced this pull request Aug 8, 2019
Provide a way to register global operator extra
links through airflow plugins.

(cherry picked from commit d333ffa)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants