A simple CLI tool to gather statistics from datagrepper
This tool helps pull statistics of any Fedora user with an active FAS Account account.
This tool usesargparse to parse arguments. This can be used in two ways, one-liner / interactive method.
The interactive mode can be enabled by using the --interactive or -i flag. This mode of usage does not require any additional argument. Please note that the arguments passed (if any) will be invalid.
One-liner uses the classic argument parsing method to generate output. This is useful for automating the report generation process. The only mandatory argument is --user / -u which takes the FAS username as input.
python stats.py --user=nobody or python stats.py -u nobody will generate text based statistics of user nobody from datagrepper.
--interactive / -i
--user / -u
all. If user is set as all, then the unfiltered data is pulled from datagrepper.--start / -s
MM/DD/YYYY as input, that determines the starting date for which the data is required. This will be internally converted to the epoch time. If this parameter is set along with --end, --delta is ignored.--end / -e
MM/DD/YYYY as input, that determines the end date for which the data is required. This will be internally converted to the epoch time.--weeks / -w
--start and --end values are set.--mode / -m
text. (More features will be added soon)--category / -c
--output / -o
--mode/-m argument. Please note that this option DOES NOT require an extension type. For instance, if you need an SVG output with the name nobody.svg, the --output flag should be set as nobody and not nobody.svg. the default value is stats.--group / -g
fas_credentials.cfg file. Not to be combined with --user / -u--logging / -l
True if called, does not require any argument. When logging is set, all the logs from start to end / mentioned weeks will be pulled from datagrepper and dumped into a text file according to the naming convention.All files generated by this tool are systematically named to avoid confusion. Combined with the file extension, there won't be two files with similar file names, hence preventing unexpected over-writes.
The naming convention is as follows :
All the main report files (i.e : Category Overview), text files are named as <username>_main.<extension>
The sub-category report (i.e the Category bar-chart) is named as <username>_<category>.<extension>
The further category interaction report (i.e The sub-categories chart) is named as <username>_<category>_<sub_category>.<extension>
python main.py --user=nobody
.svg format :python main.py --user=foo --mode=svg
This will create stats.svg in your $pwd.
.png format with output name as foo_stats.pngpython main.py --user=foo --mode=png --output=foo_stats
python main.py --user=foo --mode=json --start=05/23/2016 --end=05/28/2016
Please take a look at this blog-post.