Package: etagit
tagittagitis a command-line tagging system for experiments, focusing on getting rid of
researchers' waste of time on arranging / manipulating / moving the experimental result.Core functionalityRecord shell command output with tags.Report data with specified tags in various format (terminal, csv file, and hierarchical files).Parse recorded data automatically.DirectoryInstallationTutorialUsageMain commandsOther commandsTerminologyInstallationtagitis distributed via PyPI with the name ofetagit.
The name of the script is the same astagit, though.$ pip3 install etagitNote: If you have python < 3.7, you should install sqlite3 development package that containssqlite3.h. Otherwise, tagit may output some errors. Instruction for some distros is given below.Ubuntu/Debian$ sudo apt install libsqlite3-devCentOS/Fedora/RHEL$ sudo yum install libsqlite3x-develAn example: Lisa's storyConsider a curious sysadmin intern, Lisa, trying to discover the effect of system configurations on the performance (i.e. throughput) of server workloads.
Lisa measures the performance by changing system configurations: OS, memory size, storage device, network, database and the number of worker threads.
Since the total number of configuration sets is large (6 configurations with 3 different values each result in 729 combinations!),
Lisa writes a simple script to record the experiment result hierarchically;
configuration values are saved as directory trees (e.g.,ubuntu1804/8/HDD/10/mysql/16/result.txt).
After all combinations are tested, Lisa wants to analyze the results using spreadsheet, however,
only the raw data is saved under directory structure.
Lisa googles out and notices that she should do the two jobs:
convert each data to useful data, and accumulate them into one file (e.g., .csv) that spreadsheet apps can import.
Lisa spends a day to learn utilities needed for extracting likesed,awkandgrep,
and she finally makes it to import the data to spreadsheet.After a month, Lisa decides to present her experiment as it is the last week of the internship.
Unfortunately, she has lost the spreadsheet and what she got is only the raw data itself,
but now Lisa has no problem in using various utilities.
However, Lisa now finds a serious problem: what does '8' mean in the directory path?Tutorial# 1. Record the data$./run_exp.sh|tagitrecordperf"storage=sata_ssd, mem=16GB"IOPSis20K
latencyis100us
Newexperiment:[perf][perf]Newtagadded:
-storage
-mem

$./run_exp.sh|tagitrecordperf"storage=nvme_ssd, mem=16GB"IOPSis40K
latencyis10us$./run_exp.sh|tagitrecordperf"storage=nvme_ssd, mem=32GB"IOPSis60K
latencyis10us# 2. List experiments$tagitlist
perf# 3. Report the data$tagitreportperf[perf](storage=sata_ssd,mem=16GB)-raw:IOPSis20K
latencyis100us[perf](storage=nvme_ssd,mem=16GB)-raw:IOPSis40K
latencyis10us[perf](storage=nvme_ssd,mem=32GB)-raw:IOPSis60K
latencyis10us

$tagitreportperf"mem=16GB, storage"[perf](mem=16GB,storage=sata_ssd)-raw:IOPSis20K
latencyis100us[perf](mem=16GB,storage=nvme_ssd)-raw:IOPSis40K
latencyis10us# 4. Parse recorded data$tagitparseaddperfiops"awk '/^IOPS/{print \$NF}'"[perf]Newdatacategory:
-iops

$tagitparseaddperflatency"awk '/^latency/{print \$NF}'"[perf]Newdatacategory:
-latency

$tagitparselistperfidrulesrcdestupdated
----------------------------------------------------0awk'/^IOPS/{print $NF}'rawiopsTrue1awk'/^latency/{print $NF}'rawlatencyTrue

$tagitreportperf-d"latency, iops"[perf](storage=sata_ssd,mem=16GB)-latency:100us
-iops:20K[perf](storage=nvme_ssd,mem=16GB)-latency:10us
-iops:40K[perf](storage=nvme_ssd,mem=32GB)-latency:10us
-iops:60K# 5. Delete a data$tagitmanageperf-r"mem=32GB"$tagitreportperf-d"latency, iops"[perf](storage=sata_ssd,mem=16GB)-latency:100us
-iops:20K[perf](storage=nvme_ssd,mem=16GB)-latency:10us
-iops:40K# 6. Delete an experiment$tagitmanageperf-d

$tagitlistUsageMain commands1.record$ tagit record <exp_name> <tags> [-d <data_category>] [-q]Recordsstdintagged with<tags>in<exp_name>space.<tags>must be specified with double quotes (e.g.,$ ./run_exp.sh | tagit record myexp "a=1, b=2").
The data category into which data is recorded can be specified using-doption; the default category israw.
If-qis specified, data is recorded quietly.2.report$ tagit report <exp_name> [<tags>] [-c <csv_file>] [-f <path>] [-d <data_category>]Reports the data in<exp_name>space.
If<tags>are specified, tagit reports data corresponding to the specified tags.
By default, the result is printed in terminal.
Data category to be reported can be specified using-doption, and all data categories are reported by default.Multi-valued tagsUsers can choose multiple tag values at a time using the operator|.Example:"color=red|blue, shape=cube"Tag orderUsers can specify the tag order in<tag>. For example,"c=3, b=2, a=1"makes tags printed in c-b-a order.Also, tag can be specified without values like"c, b=2, a".
This is for setting the tag order without changing the report scope.Result format options-c: Print the result in csv format-f: Print the result in file hierarchy; each data is saved as a file under the nested directory path, where each directory corresponds to a tag3.parse3.1.parse add$ tagit parse add <exp_name> [-s <src_category>] <dest_category> <rule>Add a parsing rule to an experiment<exp_name>.
For each data in experiment<exp_name>,<rule>is applied torawcategory, and the result is saved in<dest_category>.
If<src_category>is specified, the<rule>is applied to<src_category>.
The<rule>should follow shell command format (For example:awk '^latency/{print \$NF}').3.2.parse list$ tagit parse list <exp_name>List parsing rules in the experiment<exp_name>.3.3.parse remove$ tagit parse remove <exp_name> [-a] [<rule_id>]Remove parsing rule of id<rule_id>:from the experiment<exp_name>.
If-ais specified, all parsing rules are removed.4.manage$ tagit manage <exp_name> [-d] [-r [<tags>]]Manages recorded data in <exp_name> space.Manange options-d: Delete an experiment.-r: Delete data corresponding to the specified tags in an experiment.
This does not delete an experiment, even though every data is deleted.Other commands1.list$ tagit list [<exp_name>]List the experiments. If<exp_name>is specified, it lists the name of tags and data categories in the specified experiment instead.2.exp2.1.exp rename$ tagit exp rename <exp_name> <new_name>Rename the experiment<exp_name>to<new_name>.3.tag3.1.tag rename$ tagit tag rename <exp_name> <name> <new_name>In the experiment<exp_name>, rename the tag<name>to<new_name>.3.2.tag fix$ tagit tag fix <exp_name> <tags>In the experiment<exp_name>, fix the value of tags according to<tags>.
For example,"color=blue, shape=cube"fixes the tagscolorandshapetoblueandcube, respectively.
When the value of the tag fixed by this command is not specified, the value is set to the fixed value.
The fixed values can be overrided by values specified during recording.3.3.tag unfix$ tagit tag unfix <exp_name> <tags>In the experiment<exp_name>, unfix the value of tags according to<tags>.
Tags must be specified without values in<tags>(e.g.,"color, shape").3.4.tag update$ tagit tag update <exp_name> <tags>In the experiment<exp_name>, update the value of tags according to<tags>.
In<tags>,=is used for limiting the scope of update, and->is used for specifying the value to update.
For example,"color=red, shape=sphere, color->blue, volume->10L"updatescolortoblueandvolumeto10L, for records withcolor=red, shape=sphere.4.export$ tagit export <output_dump>Export all experiment and data to<output_dump>.5.import$ tagit import <db_dump>Import experiments and data from<db_dump>.6.reset$ tagit reset [-y]Reset tagit database.-ypasses all yes to prompts automatically.Terminologytagithas five main concepts: experiments, tags, data, data categories, and parsing rules.Anexperimentis a set of tagged data.
Data in the same experiment commonly share a number of tags with different values.
The name came from scientific methods,
which usually involves collection of experiment results with different set of variables (which corresponds to tags intagit).Atagis similar to variable in scientific experiments;
it has a key and multiple values (e.g., "color=red", "color=yellow").
Since it is quite common for tags to stick to theoptimalorfinalvalue in experiments,
A tag may have the default value (coming soon!)Adatais the element oftagit.
Each data belongs to a data category, and may have multiple tags (e.g., "color=red, shape=sphere").Adata categorydescribes the characteristic of the recorded data.
It is similar to tag; however, it is used for parsing recorded data.
When data is recorded, its category israwby default,
and the data can be parsed and saved into different categories (e.g.,throughput,latency).
Experimental results or stats are generally recorded in a single place (a simple example is/proc/vmstat, which shows the stats of virtual memory subsystem),
thus data categories can be useful for parsing necessary information from the whole data.Aparsing ruleis applied to each recorded data in an experiment to parse it and generate useful data.
The generated data is saved into the data category specified in the parsing rule.
Once a parsing rule is registered in an experiment, it is automatically applied to data recorded in the future, as well as the data already recorded.NotesThis tool is currently a beta version and may contain some bugs.
Issues & pull requests about new features, bug reports are appreciated.