Implemented the show-log command along with flag: -f, --filepath#17
Open
MightyShashank wants to merge 9 commits intoceph:mainceph/ceph-devstack:mainfrom
Open
Implemented the show-log command along with flag: -f, --filepath#17MightyShashank wants to merge 9 commits intoceph:mainceph/ceph-devstack:mainfrom
MightyShashank wants to merge 9 commits intoceph:mainceph/ceph-devstack:mainfrom
Conversation
Signed-off-by: Shashank Tippanavar <152605527+MightyShashank@users.noreply.github.com>
Implementation of show_log Signed-off-by: Shashank Tippanavar <152605527+MightyShashank@users.noreply.github.com>
Update __init__.py to include option for --filepath flag Signed-off-by: Shashank Tippanavar <152605527+MightyShashank@users.noreply.github.com>
Updated cli.py to include option for calling show-log Signed-off-by: Shashank Tippanavar <152605527+MightyShashank@users.noreply.github.com>
Signed-off-by: Shashank Tippanavar <152605527+MightyShashank@users.noreply.github.com>
Signed-off-by: Shashank Tippanavar <152605527+MightyShashank@users.noreply.github.com>
Signed-off-by: Shashank Tippanavar <152605527+MightyShashank@users.noreply.github.com>
VallariAg
reviewed
Apr 9, 2025
Member
VallariAg
left a comment
There was a problem hiding this comment.
thank you, good work!
Leaving these comments for gsoc reviews. Not approving since the PR is just for evaluation task.
|
|
||
| async def show_log(self, filepath: bool = False): | ||
| home_dir = os.path.expanduser("~") | ||
| target_dir = os.path.join(home_dir, ".local", "share", "ceph-devstack", "archive") |
Member
There was a problem hiding this comment.
~/.local/share/ceph-devstack is the default directory where archives are stored but it can be configureable with --data-dir so it's a good idea to not hardcode the archive path here
| logger.error(f"Could not find container {container_name}") | ||
| return 1 | ||
|
|
||
| async def show_log(self, filepath: bool = False): |
Member
There was a problem hiding this comment.
Nit: boolean variables can be named something like is_filepath for readability
Comment on lines
+269
to
+271
| elif filepath: | ||
| logger.info(f"{log_file_path}") | ||
| return 0 |
Member
There was a problem hiding this comment.
Suggested change
| elif filepath: | |
| logger.info(f"{log_file_path}") | |
| return 0 | |
| elif os.path.exists(log_file_path) and os.path.isfile(log_file_path) and filepath: | |
| logger.info(f"{log_file_path}") | |
| return 0 |
otherwise it'll print the teuthology.log file path even if job directory exists but teuthology.log file does not exist
Comment on lines
+285
to
+286
| elif filepath: | ||
| logger.info(f"{log_file_path}") |
Member
There was a problem hiding this comment.
Suggested change
| elif filepath: | |
| logger.info(f"{log_file_path}") | |
| elif os.path.exists(log_file_path) and os.path.isfile(log_file_path) and filepath: | |
| logger.info(f"{log_file_path}") |
same comment as above
| except Exception as e: | ||
| logger.error(f"Error extracting timestamp from {dir_name}: {e}") | ||
| return None | ||
| run_directories_list.sort(key=lambda dir: extract_timestamp(dir), reverse=True) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The show-log command displays the contents of the most recent teuthology.log file. The optional -f or --filepath flag can be used to display only the filepath of the latest teuthology.log file instead of its contents.
Usage:
ceph-devstack show-log -f