Skip to content

Conversation

@mik-laj
Copy link
Member

@mik-laj mik-laj commented Nov 25, 2019

Make sure you have checked all steps below.

Jira

Description

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

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

@mik-laj mik-laj changed the title [AIRFLOW-6065][depends on AIRFLOW-6047] Add StackdriverTaskHandler [AIRFLOW-6065][depends on AIRFLOW-6047][WIP] Add StackdriverTaskHandler Nov 25, 2019
@mik-laj mik-laj force-pushed the AIRFLOW-6065 branch 2 times, most recently from 52cad3b to 6f55793 Compare November 26, 2019 11:32
@mik-laj mik-laj changed the title [AIRFLOW-6065][depends on AIRFLOW-6047][WIP] Add StackdriverTaskHandler [AIRFLOW-6065][depends on AIRFLOW-6047][WIP] Add Stackdriver Task Handler Nov 26, 2019
@mik-laj mik-laj added the provider:google Google (including GCP) related issues label Nov 26, 2019
@mik-laj mik-laj force-pushed the AIRFLOW-6065 branch 2 times, most recently from 30bb377 to 9ebec28 Compare November 27, 2019 15:06
@mik-laj mik-laj changed the title [AIRFLOW-6065][depends on AIRFLOW-6047][WIP] Add Stackdriver Task Handler [AIRFLOW-6065] Add Stackdriver Task Handler Dec 3, 2019
@codecov-io
Copy link

codecov-io commented Dec 4, 2019

Codecov Report

Merging #6660 into master will decrease coverage by 0.44%.
The diff coverage is 92.79%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #6660      +/-   ##
==========================================
- Coverage    86.6%   86.16%   -0.45%     
==========================================
  Files         873      874       +1     
  Lines       40725    40836     +111     
==========================================
- Hits        35271    35186      -85     
- Misses       5454     5650     +196
Impacted Files Coverage Δ
airflow/config_templates/airflow_local_settings.py 65.38% <16.66%> (-6.36%) ⬇️
airflow/utils/log/stackdriver_task_handler.py 97.14% <97.14%> (ø)
...w/providers/apache/hive/operators/mysql_to_hive.py 35.84% <0%> (-64.16%) ⬇️
airflow/kubernetes/volume_mount.py 44.44% <0%> (-55.56%) ⬇️
airflow/kubernetes/volume.py 52.94% <0%> (-47.06%) ⬇️
airflow/security/kerberos.py 30.43% <0%> (-45.66%) ⬇️
airflow/kubernetes/pod_launcher.py 47.18% <0%> (-45.08%) ⬇️
airflow/providers/mysql/operators/mysql.py 55% <0%> (-45%) ⬇️
airflow/kubernetes/refresh_config.py 50.98% <0%> (-23.53%) ⬇️
...viders/cncf/kubernetes/operators/kubernetes_pod.py 70.21% <0%> (-23.41%) ⬇️
... and 4 more

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 1e00243...ea1c391. Read the comment docs.

Copy link
Member

Choose a reason for hiding this comment

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

Do we want to have both read and emit in the same class? I think it will be better if we have separate "Logging Handler" and separate LogReader - maybe deriving from the same base class. I think those two have fundamentally different purpose and should be separated.

Also it should be described how to configure reading the logs from stackdriver. This can be separated out to a completely separate PR BTW.

Copy link
Member Author

@mik-laj mik-laj Dec 5, 2019

Choose a reason for hiding this comment

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

I would like to avoid modifying the API, but in this change I would like to implement the current Airflow interface. Currently in Airflow the process of saving and reading is combined in one class.
If you want, you can configure another handler to read logs using task_log_reader option in airflow.cfg file.
https://github.com/apache/airflow/blob/master/airflow/config_templates/default_airflow.cfg#L191-L193
I agree that the log API needs improvement, but this is not the scope of this PR.

Can you look at my comment that discusses API issues?
#5177 (comment)

Copy link
Member

@ashb ashb Dec 10, 2019

Choose a reason for hiding this comment

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

Suggested change
:class:`logging.config.dictConfig`. If your file is not importable, then you should set a :any:``PYTHONPATH`` environment.
:class:`logging.config.dictConfig`. If your file is not in a standard import location, then you should set a :any:``PYTHONPATH``
environment. Airflow adds the ``config/`` folder inside ``AIRFLOW_HOME`` to the import path for this purpose.

Copy link
Member

Choose a reason for hiding this comment

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

I don't think the __init__ is needed here, as ~/airflow/config is already in the python path so can be imported as log_config

Copy link
Member Author

Choose a reason for hiding this comment

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

Right. In Python 2.7 this was required.

Copy link
Member

Choose a reason for hiding this comment

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

We've had problems in the past with the default config  changing and people's installs breaking.

I think we should instead recommend people do this as

form copy import deepcopy
from airflow.config_templates.airflow_local_settings import DEFAULT_LOGGING_CONFIG

LOGGING_CONFIG = deepcopy(DEFAULT_LOGGING_CONFIG)

# Update LOGGING_CONFIG as needed.

Copy link
Member Author

Choose a reason for hiding this comment

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

I updated the description

@potiuk
Copy link
Member

potiuk commented Feb 10, 2020

Please rebase to latest master @mik-laj - we had a six drama on Travis but it's solved now.

@mik-laj mik-laj force-pushed the AIRFLOW-6065 branch 2 times, most recently from 2f181f4 to 66cd96c Compare February 10, 2020 14:10
@mik-laj mik-laj merged commit 6b19889 into apache:master Feb 12, 2020
@galuszkak
Copy link
Contributor

galuszkak commented Feb 13, 2020

@potiuk @mik-laj nice, we started on same thing 2 weeks ago in our hourly morning mini hackathons. Sounds you did it a lot before us.

@mik-laj
Copy link
Member Author

mik-laj commented Feb 13, 2020

If you are interested, you can work on integrating Web UI with Stackdriver.
Here is POC: PolideaInternal#660
Unfortunately, I don't have time to finish it and test it.

@galuszkak
Copy link
Contributor

@mik-laj we have every week mini hackathon so if this is not urgent we are doing this every Thursday 8:00-9:30 with 5-6 people.

Now we are working on enabling multiple remote loggers in Airflow, and we can also try to take this Stackdriver logs in Web UI.

@mik-laj
Copy link
Member Author

mik-laj commented Feb 20, 2020

If you would like to work more on OOS then we are recruiting ;-)
https://www.polidea.com/hiring/

This is absolutely not urgent. This is just one of my ideas that I came up with while working on this PR.

galuszkak pushed a commit to FlyrInc/apache-airflow that referenced this pull request Mar 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:logging provider:google Google (including GCP) related issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants