spacepy / dbprocessing

Automated processing controller for heliophysics data
5 stars 4 forks source link

Use exit code of printProcessQueue to indicate if the queue is empty #87

Closed jtniehof closed 2 years ago

jtniehof commented 3 years ago

It's useful to be able to, in automated processing, take different actions based on whether there's anything in the process queue (e.g. skip processing if nothing got ingested.) printProcessQueue gives that information, but it's hard to check that programmatically.

Proposed enhancement

printProcessQueue should take a flag (letter TBD). Iff this flag is set, set the exit code: 0 if there's something in the process queue (by analogy with grep), and 1 if it's empty.

Possible flag name: -q for quiet (and then only set exit status, don't print...although maybe we want the ability to print output and also set exit status?)

Alternatives

magically grepping the output

OS, Python version, and dependency version information:

Linux-4.15.0-153-generic-x86_64-with-Ubuntu-18.04-bionic
sys.version_info(major=2, minor=7, micro=17, releaselevel='final', serial=0)
sqlalchemy=1.1.11

Version of dbprocessing

Current github master

Closure condition

Close when merge a commit with the suggested flag

jtniehof commented 3 years ago

Also possibly a flag for "count" that just dumps the number of files in the process queue to stdout (easier to parse than grepping the detail)