# Produce warning message when QuantumGraph is empty

XMLWordPrintable

## Details

• Type: Story
• Status: Done
• Resolution: Done
• Fix Version/s: None
• Component/s:
• Labels:
None
• Story Points:
0.5
• Sprint:
DB_S19_04
• Team:
Data Access and Database

## Description

When pipetask makes an empty QuantumGraph it would be useful to notify user about that, people get confused if everything looks OK and there are no messages, but then nothing is executed. I think it deserves a WARNING message if graph is empry, maybe we can also print some INFO like number of quanta in a graph.
Understanding why graph is empty is a more complicated (existential) problem, it will be addressed on a separate ticket.

## Activity

Hide
Andy Salnikov added a comment -

With a trivial fix pipetask now produces a warning when QuantumGraph is empty:

 /project/salnikov/gen3-middleware/ctrl_mpexec/python/lsst/ctrl/mpexec/cmdLineFwk.py:128: UserWarning: QuantumGraph is empty  qgraph = self.makeGraph(pipeline, taskFactory, args) 

This is done with warnings module so potentially it can be promoted to exception if needed (or suppressed). Unit test adds a check that warning is indeed generated for a simple test case that we have there.

For non-empty QunatumGraph it makes an INFO message:

 ctrl.mpexec.cmdLineFwk INFO: QuantumGraph contains 4 quanta for 1 tasks 

Show
Andy Salnikov added a comment - With a trivial fix pipetask now produces a warning when QuantumGraph is empty: /project/salnikov/gen3-middleware/ctrl_mpexec/python/lsst/ctrl/mpexec/cmdLineFwk.py:128: UserWarning: QuantumGraph is empty qgraph = self.makeGraph(pipeline, taskFactory, args) This is done with warnings module so potentially it can be promoted to exception if needed (or suppressed). Unit test adds a check that warning is indeed generated for a simple test case that we have there. For non-empty QunatumGraph it makes an INFO message: ctrl.mpexec.cmdLineFwk INFO: QuantumGraph contains 4 quanta for 1 tasks
Hide
Andy Salnikov added a comment -

Michelle Gower, can you review my quick fix, it is trivial and short.

Show
Andy Salnikov added a comment - Michelle Gower , can you review my quick fix, it is trivial and short.
Hide
Andy Salnikov added a comment - - edited

Following up review question I have enable warning capture in pipetask (doing trivial logging.captureWarnings(True) in cmdLineFwk). The warnings now look like:

 py.warnings WARN: /project/salnikov/gen3-middleware/ctrl_mpexec/python/lsst/ctrl/mpexec/cmdLineFwk.py:128: UserWarning: QuantumGraph is empty  qgraph = self.makeGraph(pipeline, taskFactory, args) 

when sent to a standard error. It's probably not a big deal for this particular warning but I can imagine it can be important for other warnings when we do some sort of logging collection beyond just regular log files.

Show
Andy Salnikov added a comment - - edited Following up review question I have enable warning capture in pipetask (doing trivial logging.captureWarnings(True) in cmdLineFwk). The warnings now look like: py.warnings WARN: /project/salnikov/gen3-middleware/ctrl_mpexec/python/lsst/ctrl/mpexec/cmdLineFwk.py:128: UserWarning: QuantumGraph is empty qgraph = self.makeGraph(pipeline, taskFactory, args) when sent to a standard error. It's probably not a big deal for this particular warning but I can imagine it can be important for other warnings when we do some sort of logging collection beyond just regular log files.
Hide
Andy Salnikov added a comment -

Thanks for review! Merged and done.

Show
Andy Salnikov added a comment - Thanks for review! Merged and done.

## People

• Assignee:
Andy Salnikov
Reporter:
Andy Salnikov
Reviewers:
Michelle Gower
Watchers:
Andy Salnikov, Michelle Gower