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

[AIRFLOW-1879] Handle ti log entirely within ti #2837

Closed
wants to merge 1 commit into from

Conversation

bolkedebruin
Copy link
Contributor

@bolkedebruin bolkedebruin commented Dec 2, 2017

Make sure you have checked all steps below.

JIRA

Description

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

Previously logging was setup outside a TaskInstance,
this puts everything inside. Also propery closes
the logging.

Tests

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

Covered by current tests.

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
    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"
  • Passes git diff upstream/master -u -- "*.py" | flake8 --diff

cc: @ashb @Fokko @jgao54

Previously logging was setup outside a TaskInstance,
this puts everything inside. Also propery closes
the logging.

hostname = socket.getfqdn()
log.info("Running on host %s", hostname)
log.info("Running %s on host %s", ti, hostname)
Copy link
Member

Choose a reason for hiding this comment

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

Think you want ti.log.info here.

Copy link
Member

Choose a reason for hiding this comment

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

Oh maybe not. I thought log wasn't a local variable anymore but tests pass so :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

log is actually a local variable as well. I thought it made more sense to log in that facility rather than 'hijack' the TI log.

@codecov-io
Copy link

codecov-io commented Dec 2, 2017

Codecov Report

Merging #2837 into master will decrease coverage by 0.06%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2837      +/-   ##
==========================================
- Coverage   74.01%   73.94%   -0.07%     
==========================================
  Files         159      159              
  Lines       12076    12075       -1     
==========================================
- Hits         8938     8929       -9     
- Misses       3138     3146       +8
Impacted Files Coverage Δ
airflow/bin/cli.py 53.81% <100%> (-0.21%) ⬇️
airflow/models.py 87.37% <100%> (+0.01%) ⬆️
airflow/utils/log/logging_mixin.py 100% <100%> (ø) ⬆️
airflow/task_runner/bash_task_runner.py 93.33% <0%> (-6.67%) ⬇️
airflow/utils/helpers.py 53.44% <0%> (-2.88%) ⬇️
airflow/jobs.py 79.53% <0%> (-0.45%) ⬇️
airflow/utils/log/file_processor_handler.py 89.85% <0%> (+2.89%) ⬆️

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 406d738...ebd327a. Read the comment docs.

@bolkedebruin
Copy link
Contributor Author

@Fokko PTAL

@Fokko
Copy link
Contributor

Fokko commented Dec 6, 2017

I like it, we don't want any logging logic inside of the cli class.

@asfgit asfgit closed this in 301ce6b Dec 6, 2017
ghost pushed a commit to RealImpactAnalytics/airflow that referenced this pull request Dec 7, 2017
Previously logging was setup outside a
TaskInstance,
this puts everything inside. Also propery closes
the logging.

Closes apache#2837 from bolkedebruin/AIRFLOW-1879
Acehaidrey pushed a commit to Acehaidrey/incubator-airflow that referenced this pull request Jan 19, 2018
Previously logging was setup outside a
TaskInstance,
this puts everything inside. Also propery closes
the logging.

Closes apache#2837 from bolkedebruin/AIRFLOW-1879
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.

None yet

4 participants