Skip to content

fix(core): purge partially generated assets on build failure#7462

Open
Shreyansh1729 wants to merge 3 commits intoOpenBB-finance:developfrom
Shreyansh1729:fix/build-purge-incomplete-assets
Open

fix(core): purge partially generated assets on build failure#7462
Shreyansh1729 wants to merge 3 commits intoOpenBB-finance:developfrom
Shreyansh1729:fix/build-purge-incomplete-assets

Conversation

@Shreyansh1729
Copy link
Copy Markdown
Contributor

Resolves #7379.

Description

Following the reviewer feedback on #7460, this PR addresses the root cause of the ImportError by ensuring that the build process cleans up (purges) any partially generated files if an exception occurs mid-run.

Changes

  • Wrapped build generation steps in a try...except block in PackageBuilder.build.
  • Triggers self._clean(modules) on failure to ensure a consistent workspace state.
  • Added a regression test in test_package_builder.py to verify the purge behavior.

@deeleeramone
Copy link
Copy Markdown
Contributor

Nice, this is a good solution @Shreyansh1729! To be helpful to the end user, I think it would be a good idea to include the traceback with the offending code as a console.log.error message + an instruction to set OPENBB_DEBUG_MODE='true' environment variable, then run openbb-build again to enable verbose output.

@Shreyansh1729
Copy link
Copy Markdown
Contributor Author

Done! I've updated the PR to include full traceback logging and user instructions for OPENBB_DEBUG_MODE as suggested. I also updated the Console utility to ensure these critical build errors are always visible. Let me know if there's anything else!

@Shreyansh1729
Copy link
Copy Markdown
Contributor Author

@deeleeramone any updates ?

@deeleeramone
Copy link
Copy Markdown
Contributor

@Shreyansh1729, this is good thanks. There is an edge case here that we should probably catch in the outer try block as well, KeyboardInterrupt or signal.SIGTERM + signal.SIGINT. Currently, if the process is terminated - either by the user or programmatically - the partially generated modules survive. How do you think we can guard against that?

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.

ImportError: OBBject_EquityInfo not found in provider_interface (v4.6.0)

2 participants