Skip to content

Commit 7c46f4e

Browse files
fix: Avoid frequent writes to graph.json in a loop
Before this change, we would write the `graph.json` over and over again for every single dependency that's added while the dependency graph is being created. This commit changes this behavior to only write to the file once, only when all dependencies have been already added. Signed-off-by: Michael Yochpaz <[email protected]>
1 parent c56d5f3 commit 7c46f4e

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

src/fromager/bootstrapper.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -951,7 +951,6 @@ def _add_to_graph(
951951
download_url=download_url,
952952
pre_built=pbi.pre_built,
953953
)
954-
self.ctx.write_to_graph_to_file()
955954

956955
def _sort_requirements(
957956
self,

src/fromager/commands/bootstrap.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,8 @@ def bootstrap(
185185
progressbar.update()
186186
requirement_ctxvar.reset(token)
187187

188+
wkctx.write_to_graph_to_file()
189+
188190
constraints_filename = wkctx.work_dir / "constraints.txt"
189191
if skip_constraints:
190192
logger.info("skipping constraints.txt generation as requested")

0 commit comments

Comments
 (0)