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-6522] Clear log file to fix duplication in S3TaskHandler #7120

Merged

Conversation

rconroy293
Copy link
Contributor

@rconroy293 rconroy293 commented Jan 10, 2020

The same task instance (including try number) can be run on a worker
when using a sensor in "reschedule" mode. This PR clears the
local log file when re-initializing the logger so that the old log
lines aren't uploaded again when the logger is closed on subsequent runs.


Issue link: AIRFLOW-6522

  • Description above provides context of the change
  • Commit message/PR title starts with [AIRFLOW-NNNN]. AIRFLOW-NNNN = JIRA ID*
  • Unit tests coverage for changes (not needed for documentation changes)
  • Commits follow "How to write a good git commit message"
  • Relevant documentation is updated including usage instructions.
  • I will engage committers as explained in Contribution Workflow Example.

* For document-only changes commit message can start with [AIRFLOW-XXXX].


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.
Read the Pull Request Guidelines for more information.

@boring-cyborg boring-cyborg bot added area:logging provider:amazon-aws AWS/Amazon - related issues labels Jan 10, 2020
The same task instance (including try number) can be run on a worker
when using a sensor in "reschedule" mode. Accordingly, this clears the
local log file when re-initializing the logger so that the old log
lines aren't uploaded again when the logger is closed.
@rconroy293 rconroy293 force-pushed the AIRFLOW-6522-s3-task-handler-log-duplication branch from a040930 to 1fc4738 Compare January 10, 2020 16:53
@kaxil kaxil requested review from ashb and mik-laj January 10, 2020 22:55
Copy link
Member

@ashb ashb left a comment

Choose a reason for hiding this comment

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

Trying to think if there are any edge cases to this (such as cases where the upload fails and we might loose the log?)

Can't think of any immediate ones, so LGTM.

@rconroy293
Copy link
Contributor Author

Trying to think if there are any edge cases to this (such as cases where the upload fails and we might loose the log?)

Can't think of any immediate ones, so LGTM.

The other option I considered was downloading the existing log from S3 into the file first (i.e. on initialization of the logger). If that succeeds, it can just overwrite with the local file. If it fails, it can use the existing append technique. Not sure your thoughts on that @ashb

@ashb ashb merged commit 88608ca into apache:master Jan 14, 2020
@boring-cyborg
Copy link

boring-cyborg bot commented Jan 14, 2020

Awesome work, congrats on your first merged pull request!

@rconroy293 rconroy293 deleted the AIRFLOW-6522-s3-task-handler-log-duplication branch January 14, 2020 17:00
kaxil pushed a commit that referenced this pull request Jan 23, 2020
… in S3TaskHandler (#7120)

The same task instance (including try number) can be run on a worker
when using a sensor in "reschedule" mode. Accordingly, this clears the
local log file when re-initializing the logger so that the old log
lines aren't uploaded again when the logger is closed.

(cherry picked from commit 88608ca)
potiuk pushed a commit that referenced this pull request Jan 26, 2020
… in S3TaskHandler (#7120)

The same task instance (including try number) can be run on a worker
when using a sensor in "reschedule" mode. Accordingly, this clears the
local log file when re-initializing the logger so that the old log
lines aren't uploaded again when the logger is closed.

(cherry picked from commit 88608ca)
kaxil pushed a commit that referenced this pull request Jan 26, 2020
… in S3TaskHandler (#7120)

The same task instance (including try number) can be run on a worker
when using a sensor in "reschedule" mode. Accordingly, this clears the
local log file when re-initializing the logger so that the old log
lines aren't uploaded again when the logger is closed.

(cherry picked from commit 88608ca)
kaxil pushed a commit that referenced this pull request Feb 3, 2020
… in S3TaskHandler (#7120)

The same task instance (including try number) can be run on a worker
when using a sensor in "reschedule" mode. Accordingly, this clears the
local log file when re-initializing the logger so that the old log
lines aren't uploaded again when the logger is closed.

(cherry picked from commit 88608ca)
galuszkak pushed a commit to FlyrInc/apache-airflow that referenced this pull request Mar 5, 2020
… in S3TaskHandler (apache#7120)

The same task instance (including try number) can be run on a worker
when using a sensor in "reschedule" mode. Accordingly, this clears the
local log file when re-initializing the logger so that the old log
lines aren't uploaded again when the logger is closed.
tylr-mk added a commit to guardian/amigo that referenced this pull request Apr 21, 2020
While here add a `files/` dir to the module. This allows the
subdirectories to be called in the ansible patch module itself because
it will search relative to this path.

Actual patch:

  Taken from: apache/airflow#7120
  Related to: https://issues.apache.org/jira/browse/AIRFLOW-6522
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:logging provider:amazon-aws AWS/Amazon - related issues
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants