Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion src/taskgraph/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,16 @@ def format_taskgraph(options, parameters, overrides, logfile=None):
return format_method(tg)


def format_taskgraph_multiple(*args, **kwargs):
"""Thin wrapper around format_taskgraph to avoid the taskgraph generator
that it runs using multiple processes. (This function is intended to be
called by something that is already using a ProcessPoolExecutor, so
there's no advantage to spawning additional processes in the subprocesses.)"""

os.environ["TASKGRAPH_SERIAL"] = "1"
return format_taskgraph(*args, **kwargs)


def dump_output(out, path=None, params_spec=None):
from taskgraph.parameters import Parameters # noqa: PLC0415

Expand Down Expand Up @@ -226,7 +236,7 @@ def logfile(spec):
with ProcessPoolExecutor(max_workers=options["max_workers"]) as executor:
for spec in parameters:
f = executor.submit(
format_taskgraph, options, spec, overrides, logfile(spec)
format_taskgraph_multiple, options, spec, overrides, logfile(spec)
)
futures[f] = spec

Expand Down