Skip to content

fix: WandbLogger crashing silently on a FileNotFoundError#50308

Merged
matthewdeng merged 6 commits intoray-project:masterfrom
Daraan:wandb-file-not-found
Jun 12, 2025
Merged

fix: WandbLogger crashing silently on a FileNotFoundError#50308
matthewdeng merged 6 commits intoray-project:masterfrom
Daraan:wandb-file-not-found

Conversation

@Daraan
Copy link
Copy Markdown
Contributor

@Daraan Daraan commented Feb 7, 2025

Signed-off-by: Daniel Sperber <github.blurry@9ox.net>
@Daraan Daraan force-pushed the wandb-file-not-found branch from 7e42185 to 139cc83 Compare February 7, 2025 14:21
@jcotant1 jcotant1 added the train Ray Train Related Issue label Feb 7, 2025
@Daraan

This comment was marked as outdated.

@hainesmichaelc hainesmichaelc added the community-contribution Contributed by the community label Apr 4, 2025
@stale
Copy link
Copy Markdown

stale bot commented May 6, 2025

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed in 14 days if no further activity occurs. Thank you for your contributions.

  • If you'd like to keep this open, just leave any comment, and the stale label will be removed.

@stale stale bot added stale The issue is stale. It will be closed within 7 days unless there are further conversation and removed stale The issue is stale. It will be closed within 7 days unless there are further conversation labels May 6, 2025
Comment on lines +423 to +427
except FileNotFoundError as e:
logger.error(
"FileNotFoundError: Possible reason: relative instead of absolute path: %s",
e,
)
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.

Were you able verify locally if this resolves the issue?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thanks for picking this up. Yes, If I include this snippet I get the error logged in my terminal:

(_WandbLoggingActor pid=1189334) FileNotFoundError: Possible reason: relative instead of absolute path: [Errno 2] No such file or directory: 'videos/vid.mp4'  

And as I do not re-raise the error the logger stays alive. The data for that iteration is lost though (no entry for step 10).
grafik

Currently logs will be truncated and lost & without any error:

grafik


I think I could extend the warning message to make this clear and forward this issue wandb as well.

Signed-off-by: Daraan <github.blurry@9ox.net>
@Daraan Daraan requested a review from matthewdeng June 5, 2025 09:36
@Daraan
Copy link
Copy Markdown
Contributor Author

Daraan commented Jun 5, 2025

I just remembered the reason why relative paths fail. The working directory is inside the session folder and not directory where I executed python. So it is not an issue addressable on the wandb side.

Copy link
Copy Markdown
Contributor

@matthewdeng matthewdeng left a comment

Choose a reason for hiding this comment

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

Looks good, just one minor adjustment to the error message.

Comment on lines +423 to +428
except FileNotFoundError as e:
logger.error(
"FileNotFoundError: This result will not be logged to WandB. "
"Possible reason: relative instead of absolute path for file %s",
e,
)
Copy link
Copy Markdown
Contributor

@matthewdeng matthewdeng Jun 7, 2025

Choose a reason for hiding this comment

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

Suggested change
except FileNotFoundError as e:
logger.error(
"FileNotFoundError: This result will not be logged to WandB. "
"Possible reason: relative instead of absolute path for file %s",
e,
)
except FileNotFoundError as e:
logger.error(
f"FileNotFoundError: Did not log result to Weights & Biases. "
f"Possible cause: relative file path used instead of an absolute path. "
f"Error: {e}"
)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thank you. I incorporated you wording your wording. Concerning the f-string I am bit reluctant to using them as they go against flake8 G004 so I left them out for now.

Signed-off-by: Daraan <github.blurry@9ox.net>
@Daraan Daraan force-pushed the wandb-file-not-found branch from b7223cf to cb6507e Compare June 7, 2025 08:27
@Daraan Daraan requested a review from matthewdeng June 12, 2025 07:13
Copy link
Copy Markdown
Contributor

@matthewdeng matthewdeng left a comment

Choose a reason for hiding this comment

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

Thanks!

@matthewdeng matthewdeng enabled auto-merge (squash) June 12, 2025 16:33
@github-actions github-actions bot added the go add ONLY when ready to merge, run all tests label Jun 12, 2025
@matthewdeng matthewdeng merged commit 5fddebd into ray-project:master Jun 12, 2025
7 checks passed
elliot-barn pushed a commit that referenced this pull request Jun 18, 2025
Signed-off-by: Daniel Sperber <github.blurry@9ox.net>
Signed-off-by: Daraan <github.blurry@9ox.net>
Co-authored-by: matthewdeng <matt@anyscale.com>
Signed-off-by: elliot-barn <elliot.barnwell@anyscale.com>
elliot-barn pushed a commit that referenced this pull request Jul 2, 2025
Signed-off-by: Daniel Sperber <github.blurry@9ox.net>
Signed-off-by: Daraan <github.blurry@9ox.net>
Co-authored-by: matthewdeng <matt@anyscale.com>
Signed-off-by: elliot-barn <elliot.barnwell@anyscale.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

community-contribution Contributed by the community go add ONLY when ready to merge, run all tests train Ray Train Related Issue

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Air] WandB logger / _WandbLoggingActor crashes silently when logging a video with relative path or if it cannot find the given file.

5 participants