Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DM-33034: move GraphViz dot utilities to pipe_base #159

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
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
1 change: 0 additions & 1 deletion python/lsst/ctrl/mpexec/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
# along with this program. If not, see <https://www.gnu.org/licenses/>.

from .cmdLineFwk import *
from .dotTools import *
from .executionGraphFixup import *
from .mpGraphExecutor import *
from .preExecInit import *
Expand Down
1 change: 1 addition & 0 deletions python/lsst/ctrl/mpexec/cli/opt/optionGroups.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ def __init__(self) -> None:
),
ctrlMpExecOpts.order_pipeline_option(),
ctrlMpExecOpts.save_pipeline_option(),
ctrlMpExecOpts.expand_pipeline_option(),
ctrlMpExecOpts.pipeline_dot_option(),
pipeBaseOpts.instrument_option(help=instrumentOptionHelp, metavar="instrument", multiple=True),
ctrlMpExecOpts.butler_config_option(required=False),
Expand Down
10 changes: 10 additions & 0 deletions python/lsst/ctrl/mpexec/cli/opt/options.py
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,16 @@
type=MWPath(dir_okay=False, file_okay=True, writable=True),
)

expand_pipeline_option = MWOptionDecorator(
"-s",
"--expand-pipeline",
help=unwrap(
"""Directory location for storing the fully-expanded
pipeline definition."""
),
type=MWPath(dir_okay=True, file_okay=False, writable=True),
)

save_qgraph_option = MWOptionDecorator(
"-q",
"--save-qgraph",
Expand Down
6 changes: 6 additions & 0 deletions python/lsst/ctrl/mpexec/cli/script/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ def build( # type: ignore
pipeline_actions,
pipeline_dot,
save_pipeline,
expand_pipeline,
show,
butler_config=None,
**kwargs,
Expand Down Expand Up @@ -67,6 +68,10 @@ def build( # type: ignore
Path location for storing GraphViz DOT representation of a pipeline.
save_pipeline : `str`
Path location for storing resulting pipeline definition in YAML format.
expand_pipeline : `str`
Directory path location for storing the expanded pipeline definition,
with all references to other files resolved and written to config files
in the directory.
show : `lsst.ctrl.mpexec.showInfo.ShowInfo`
Descriptions of what to dump to stdout.
butler_config : `str`, `dict`, or `lsst.daf.butler.Config`, optional
Expand Down Expand Up @@ -103,6 +108,7 @@ def build( # type: ignore
pipeline_actions=pipeline_actions,
pipeline_dot=pipeline_dot,
save_pipeline=save_pipeline,
expand_pipeline=expand_pipeline,
)

f = CmdLineFwk()
Expand Down
8 changes: 7 additions & 1 deletion python/lsst/ctrl/mpexec/cmdLineFwk.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,14 +68,14 @@
QuantumGraph,
TaskFactory,
buildExecutionButler,
graph2dot,
)
from lsst.pipe.base.all_dimensions_quantum_graph_builder import AllDimensionsQuantumGraphBuilder
from lsst.pipe.base.pipeline_graph import NodeType
from lsst.utils import doImportType
from lsst.utils.logging import getLogger
from lsst.utils.threads import disable_implicit_threading

from .dotTools import graph2dot
from .executionGraphFixup import ExecutionGraphFixup
from .mpGraphExecutor import MPGraphExecutor
from .preExecInit import PreExecInit, PreExecInitLimited
Expand Down Expand Up @@ -582,6 +582,12 @@ def makePipeline(self, args: SimpleNamespace) -> Pipeline:
if args.save_pipeline:
pipeline.write_to_uri(args.save_pipeline)

if args.expand_pipeline:
task_defs = list(pipeline)
pipeline.write_to_uri(args.expand_pipeline, expand=True, task_defs=task_defs)
else:
task_defs = None

return pipeline

def makeGraph(self, pipeline: Pipeline, args: SimpleNamespace) -> QuantumGraph | None:
Expand Down
Loading
Loading