fix: add logging option for directory creation in get_full_path#929
Open
wakonig wants to merge 2 commits into
Open
fix: add logging option for directory creation in get_full_path#929wakonig wants to merge 2 commits into
wakonig wants to merge 2 commits into
Conversation
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR aims to improve observability around directory creation performed by bec_lib.file_utils.get_full_path, to help identify unexpected directory creation while migrating toward a less-permissive service account. It also introduces a small polling helper to wait for directory availability.
Changes:
- Added an optional warning log in
get_full_pathwhen it is about to create a missing directory. - Added
wait_for_directory(path, timeout, interval)helper for polling until a directory exists (or timing out). - Added unit tests covering
wait_for_directorysuccess/timeout behavior.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
bec_server/bec_server/file_writer/file_writer_manager.py |
Passes a new flag to suppress directory-creation logging when calling get_full_path. |
bec_lib/bec_lib/file_utils.py |
Extends get_full_path with a logging option and adds wait_for_directory. |
bec_lib/tests/test_file_utils.py |
Adds tests for wait_for_directory. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
Description
get_full_pathcreates the directory by default. To be able to migrate to a less-permissive service account, we need to move the file access to the file writer service. For now, we should get a better awareness of methods that actually create them. To this end, I propose to add a log to the directory creation. We can monitor it later with grafana.I would expect that they actually don't create the directory as the file writer should create it as soon as the scan is opened but there could be a timing issue.
Type of Change
wait_for_directoryhelper method