-
Notifications
You must be signed in to change notification settings - Fork 16.4k
CloudWatch task handler doesn't fall back to local logs when Amazon CloudWatch logs aren't found #27564
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
Conversation
vincbeck
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice!
|
@vincbeck |
| [{"end_of_log": True}], | ||
| ) | ||
|
|
||
| def test_read_wrong_log_stream(self): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I deleted these 2 test cases for the following reasons.
- They overlap with the one I added (testing for generic failure to fetch remote logs)
- AWS error messages are now propagated to the task log. These strings could change in the future and break our unit tests.
| start_from_head=True, | ||
| ) | ||
| return "\n".join(self._event_to_str(event) for event in events) | ||
| except Exception: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am propagating the AWS error message to the task log. I think this will be useful for debugging IAM/connection issues.
| f"*** Reading local file: {self.local_log_location}/{self.remote_log_stream}\n" | ||
| ) | ||
| assert log == expected_log | ||
| expected_log_pos = 26 + len(self.local_log_location) + len(self.remote_log_stream) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Log position seems irrelevant in the context of the CloudWatch handler because we fetch/return all logs in one request. I'm following the example I found in the GCS task handler here.
| assert metadata == {"end_of_log": False, "log_pos": 31 + len(self.local_log_location)} |
|
🚀 |
…loudWatch logs aren't found (apache#27564)
Closes #27396
Summary
The CloudWatch task log handler does not default to local logs (like the documentation says it should) when remote logs are unavailable. This PR fixes the issue.
Todo
Manual check
Procedure
echo "test" >> {log file path}Expectations
Screenshot