Skip to content

Commit 49a5315

Browse files
authored
Merge pull request #602 from Pipelex/fix/Generate-graphs-enabled
Fix/generate graphs enabled
2 parents fa49fb0 + 2f861a5 commit 49a5315

File tree

5 files changed

+297
-298
lines changed

5 files changed

+297
-298
lines changed

.pipelex/pipelex.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@
3333
[pipelex.pipeline_execution_config]
3434
# Set to false to disable conversion of incoming data URLs to pipelex-storage:// URIs
3535
is_normalize_data_urls_to_storage = true
36+
# Set to false to disable generation of execution graphs
37+
is_generate_graph = true
3638

3739
[pipelex.pipeline_execution_config.graph_config.data_inclusion]
3840
# Control what data is included in graph outputs

pipelex/cli/commands/build/pipe_cmd.py

Lines changed: 11 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
from pipelex.builder.builder_loop import BuilderLoop
1313
from pipelex.builder.runner_code import generate_runner_code
1414
from pipelex.cli.cli_factory import make_pipelex_for_cli
15+
from pipelex.cli.commands.build.structures_cmd import generate_structures_from_blueprints
1516
from pipelex.cli.error_handlers import (
1617
ErrorContext,
1718
handle_model_availability_error,
@@ -153,28 +154,17 @@ def build_pipe_cmd(
153154
typer.Option("--no-extras", help="Skip generating inputs.json and runner.py, only generate the PLX file"),
154155
] = False,
155156
graph: Annotated[
156-
bool,
157+
bool | None,
157158
typer.Option("--graph/--no-graph", help="Generate execution graphs for both build process and built pipeline"),
158-
] = True,
159+
] = None,
159160
graph_full_data: Annotated[
160161
bool | None,
161162
typer.Option(
162163
"--graph-full-data/--graph-no-data",
163164
help="Override config: include or exclude full serialized data in graphs (requires --graph)",
164165
),
165166
] = None,
166-
library_dir: Annotated[
167-
list[str] | None,
168-
typer.Option(
169-
"--library-dir",
170-
"-L",
171-
help="Directory to search for pipe definitions (.plx files). Can be specified multiple times.",
172-
),
173-
] = None,
174167
) -> None:
175-
# Import here to avoid circular imports
176-
from pipelex.cli.commands.build.structures_cmd import generate_structures_from_blueprints # noqa: PLC0415
177-
178168
make_pipelex_for_cli(context=ErrorContext.VALIDATION_BEFORE_BUILD_PIPE)
179169

180170
typer.secho("🔥 Starting pipe builder... 🚀\n", fg=typer.colors.GREEN)
@@ -304,8 +294,10 @@ async def run_pipeline():
304294
save_text_to_path(text="", path=init_path)
305295
typer.secho(f"✅ Package init file saved to: {init_path}", fg=typer.colors.GREEN)
306296

307-
# Generate graphs if --graph is enabled
308-
if graph and builder_graph_spec:
297+
get_report_delegate().generate_report()
298+
299+
# Generate graphs if it was tracked during the build process
300+
if builder_graph_spec:
309301
typer.secho("\n📊 Generating graphs...", fg=typer.colors.CYAN)
310302

311303
# Save builder pipeline graph in graphs/ subfolder
@@ -324,11 +316,13 @@ async def run_pipeline():
324316
try:
325317
built_pipe_execution_config = execution_config.with_graph_config_overrides(mock_inputs=True)
326318

319+
# pass empty library_dirs to avoid loading any libraries set at env var or instance level:
320+
# we don't want any other pipeline to interfere with the pipeline we just built
327321
built_pipe_output = await execute_pipeline(
328322
plx_content=plx_content,
329323
pipe_run_mode=PipeRunMode.DRY,
330324
execution_config=built_pipe_execution_config,
331-
library_dirs=library_dir,
325+
library_dirs=[],
332326
)
333327
if built_pipe_output.graph_spec:
334328
pipeline_graph_dir = graphs_dir / "pipeline_graph"
@@ -341,7 +335,7 @@ async def run_pipeline():
341335
)
342336
if pipeline_graph_count > 0:
343337
typer.secho(
344-
f"📊 {pipeline_graph_count} pipeline graph outputs saved to: {pipeline_graph_dir}",
338+
f"📊 {pipeline_graph_count} built pipeline graph outputs saved to: {pipeline_graph_dir}",
345339
fg=typer.colors.CYAN,
346340
)
347341
except Exception as graph_exc:
@@ -350,8 +344,6 @@ async def run_pipeline():
350344
end_time = time.time()
351345
typer.secho(f"\n✅ Pipeline built in {end_time - start_time:.2f} seconds\n", fg=typer.colors.WHITE)
352346

353-
get_report_delegate().generate_report()
354-
355347
# Show how to run the pipe
356348
console = get_console()
357349
console.print("\n📋 [cyan]To run your pipeline:[/cyan]")

0 commit comments

Comments
 (0)