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

Fix issue with parsing error logs in the KPO #15638

Merged
merged 2 commits into from Jun 14, 2021

Conversation

dimberman
Copy link
Contributor

This fixes an issue where logs that do not have timestamps cause the
KubernetesPodOperator to crash. Basically error logs created by airflow
do not have timestamps, which was causing an unhandled exception that
would kill the task. This PR handles that exception and ensures
continued task processing


^ 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.

@github-actions
Copy link

github-actions bot commented May 4, 2021

The Workflow run is cancelling this PR. Building images for the PR has failed. Follow the workflow link to check the reason.

@@ -169,7 +172,7 @@ def monitor_pod(self, pod: V1Pod, get_logs: bool) -> Tuple[State, Optional[str]]
time.sleep(2)
return self._task_status(self.read_pod(pod)), result

def parse_log_line(self, line: str) -> Tuple[str, str]:
def parse_log_line(self, line: str) -> Tuple[Optional[Union[Date, Time, DateTime, Duration]], str]:
Copy link
Member

Choose a reason for hiding this comment

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

This type is overly broad - it should be Optional[Date time] shouldn't it?

@vikramkoka
Copy link
Contributor

@dimberman Just checking if this is still relevant and important to finish up?

@dimberman
Copy link
Contributor Author

@vikramkoka this ticket is still relevant but unfortunately I don't have time to address it any time soon :(

@timgriffiths
Copy link

@vikramkoka this is important effecting quite a few of our jobs (~25%) now we have moved to 2.1.0,

This fixes an issue where logs that do not have timestamps cause the
KubernetesPodOperator to crash. Basically error logs created by airflow
do not have timestamps, which was causing an unhandled exception that
    would kill the task. This PR handles that exception and ensures
    continued task processing
@ashb ashb force-pushed the fix-timestamp-kpo-logging branch from e9aa0e8 to bb9a040 Compare June 11, 2021 22:06
@github-actions
Copy link

The PR is likely OK to be merged with just subset of tests for default Python and Database versions without running the full matrix of tests, because it does not modify the core of Airflow. If the committers decide that the full tests matrix is needed, they will add the label 'full tests needed'. Then you should rebase to the latest main or amend the last commit of the PR, and push it with --force-with-lease.

@github-actions github-actions bot added the okay to merge It's ok to merge this PR as it does not require more tests label Jun 11, 2021
@ashb ashb merged commit 4752fb3 into apache:main Jun 14, 2021
@ashb ashb deleted the fix-timestamp-kpo-logging branch June 14, 2021 08:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:providers okay to merge It's ok to merge this PR as it does not require more tests provider:cncf-kubernetes Kubernetes provider related issues
Projects
None yet
Development

Successfully merging this pull request may close these issues.

KubePodOperator sometimes fails with Unable to parse string [failed]
4 participants