SQL/XML Dumps/Command management walkthrough

A speedy tour of the low level command classes
So you want to know all about the cruft in commandmanagement.py! Yeah, I didn’t think so. But let’s get started anyways.

Here’s some sample code that runs a pipeline of commands (think: zcat | grep | awk ) and later runs a series of commands (think: grep this | wc -l; grep that | wc -l )

The relevant classes are CommandPipeline and CommandSeries, so with that in mind, let’s look at the code.

Sample code
Some of the code to run the command series was taken from ProcessMonitor, because we pretty much never run a command series directly. Instead they are run by making a list of them, even a list with only one command series in it, and letting CommandsInParallel handle it.

putting it all together
We use the repo path and files in the repo to grep for text we know is in there.

Sample output
Place the module  in the subdirectory xmldumps-backup of the python dumps repo, and run it with no args to see how you should run it. TL;DR: pass the full path of the dumps repo as the only arg.

{{CodeCommentary|type=pre|content= [ariel@bigtrouble xmldumps-backup]$ python sample_commands.py /home/ariel/dumps/xmldumps-backup

Running pipeline with default args: -- command /bin/grep command /home/ariel/dumps/xmldumps-backup/dumps/commandmanagement.py (260851) started... command /usr/bin/wc -l (260852) started... Result: 131

Running pipeline with quiet: -- Result: 131

=
========

Running series with default args: -- command /bin/grep command /home/ariel/dumps/xmldumps-backup/dumps/commandmanagement.py (260855) started... command /usr/bin/wc -l (260856) started... returned from 260856 with 0 Result: 131

returned from 260856 with 0 returned from 260856 with 0 command /bin/grep command /home/ariel/dumps/xmldumps-backup/dumps/commandmanagement.py (260857) started... command /usr/bin/wc -c (260858) started... returned from 260858 with 0 Result: 6989

returned from 260858 with 0 returned from 260858 with 0

Running series with quiet: -- Result: 131

Result: 6989 }}