fix(flow): save plot output to CWD instead of hidden temp directory#5003
Closed
NIK-TIGER-BILL wants to merge 1 commit into
Closed
fix(flow): save plot output to CWD instead of hidden temp directory#5003NIK-TIGER-BILL wants to merge 1 commit into
NIK-TIGER-BILL wants to merge 1 commit into
Conversation
Fixes crewAIInc#4991 Previously, render_interactive() always wrote the HTML, CSS, and JS files into a directory created by tempfile.mkdtemp(), so running `crewai flow plot` would print a misleading success message while the actual file ended up in a hidden /tmp/… path. Now the output directory is derived from the filename argument: - If filename contains a directory component, that directory is used. - Otherwise the files are written to Path.cwd() (the user's working dir). The temporary-directory import is no longer needed and has been removed.
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.
Summary
Fixes #4991
render_interactive()was always writing the HTML, CSS, and JS files into a directory created bytempfile.mkdtemp(prefix="crewai_flow_"). This causedcrewai flow plotto print a misleading success message like:…while the actual file landed in a hidden
/tmp/crewai_flow_…/path that the user cannot easily find.Changes
tempfile.mkdtemp()with a CWD-based output directoryfilenamealready contains a directory component, that directory is usedPath.cwd()is used, so files appear in the user's working directoryimport tempfileTesting
Existing tests continue to pass. The fix is consistent with user expectation described in the issue: running
crewai flow plotnow producesguide_creator_flow.html(and its sibling CSS/JS files) in the current working directory.