Skip to content

fix: add logging option for directory creation in get_full_path#929

Merged
wakonig merged 2 commits into
mainfrom
chore/log_dir_creation
Jun 11, 2026
Merged

fix: add logging option for directory creation in get_full_path#929
wakonig merged 2 commits into
mainfrom
chore/log_dir_creation

Conversation

@wakonig

@wakonig wakonig commented Jun 2, 2026

Copy link
Copy Markdown
Member

Description

get_full_path creates 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

  • Add log to the get_full_path
  • Add a wait_for_directory helper method

@codecov

codecov Bot commented Jun 2, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@wakonig wakonig self-assigned this Jun 2, 2026
@wakonig wakonig marked this pull request as ready for review June 2, 2026 11:27
Copilot AI review requested due to automatic review settings June 2, 2026 11:27

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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_path when 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_directory success/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.

Comment thread bec_lib/bec_lib/file_utils.py
Comment thread bec_lib/bec_lib/file_utils.py
Comment thread bec_server/bec_server/file_writer/file_writer_manager.py
Comment thread bec_server/bec_server/file_writer/file_writer_manager.py
@wakonig wakonig requested a review from a team June 2, 2026 11:31
@wakonig wakonig enabled auto-merge (rebase) June 2, 2026 15:47
@wakonig wakonig force-pushed the chore/log_dir_creation branch from 83de2bd to cf7b1c1 Compare June 10, 2026 08:38
@wakonig wakonig force-pushed the chore/log_dir_creation branch from cf7b1c1 to ddad667 Compare June 11, 2026 08:43
@wyzula-jan wyzula-jan self-requested a review June 11, 2026 12:02

@wyzula-jan wyzula-jan left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

One minor comment, otherwise good.

Comment thread bec_lib/bec_lib/file_utils.py
@wyzula-jan wyzula-jan self-requested a review June 11, 2026 12:13

@wyzula-jan wyzula-jan left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🚀🚀🚀

@wakonig wakonig merged commit 8374918 into main Jun 11, 2026
37 checks passed
@wakonig wakonig deleted the chore/log_dir_creation branch June 11, 2026 12:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants