Skip to content

Commit

Permalink
Add additional quanta information for pipetask run
Browse files Browse the repository at this point in the history
  • Loading branch information
leeskelvin committed Oct 10, 2022
1 parent 52ca013 commit d6ef725
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 9 deletions.
1 change: 1 addition & 0 deletions doc/changes/DM-36145.feature.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* added additional quanta information to be displayed by the logger, showing number of quanta per task
22 changes: 14 additions & 8 deletions python/lsst/ctrl/mpexec/cmdLineFwk.py
Original file line number Diff line number Diff line change
Expand Up @@ -586,18 +586,24 @@ def makeGraph(self, pipeline: Pipeline, args: SimpleNamespace) -> Optional[Quant
if args.show_qgraph_header:
qgraph.buildAndPrintHeader()

# Count quanta in graph and give a warning if it's empty and return
# None.
# Count quanta in graph; give a warning if it's empty and return None.
nQuanta = len(qgraph)
if nQuanta == 0:
return None
else:
_LOG.info(
"QuantumGraph contains %d quanta for %d tasks, graph ID: %r",
nQuanta,
len(qgraph.taskGraph),
qgraph.graphID,
)
if _LOG.isEnabledFor(logging.INFO):
qg_tasks = []
for task_def in qgraph.iterTaskGraph():
qnodes = qgraph.getNodesForTask(task_def)
qg_tasks.append(f"{len(qnodes):>8} {task_def.label}")
task_col_max_len = len(max(qg_tasks, key=len)) - 9
qg_header = (
f"QuantumGraph contains {nQuanta} quanta for {len(qgraph.taskGraph)} tasks, "
f"graph ID: '{qgraph.graphID}'"
)
qg_title = f"\033[31m Quanta {'Task'.center(task_col_max_len)}\033[m"
qg_divider = f"\033[31m{'-'*8} {'-'*(task_col_max_len)}\033[m"
_LOG.info("\n".join([qg_header, qg_title, qg_divider] + qg_tasks + [qg_divider]))

if args.save_qgraph:
qgraph.saveUri(args.save_qgraph)
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ pydantic
networkx
git+https://github.com/lsst/daf_butler@main#egg=lsst-daf-butler
git+https://github.com/lsst/utils@main#egg=lsst-utils
git+https://github.com/lsst/pipe_base@main#egg=lsst-pipe-base
git+https://github.com/lsst/pipe_base@tickets/DM-36145#egg=lsst-pipe-base
git+https://github.com/lsst/pex_config@main#egg=lsst-pex-config

0 comments on commit d6ef725

Please sign in to comment.