Distributed Release Audit Tool (DRAT)
A distributed, parallelized (Map Reduce) wrapper around Apache™ RAT to allow it to complete on large code repositories of multiple file types where Apache™ RAT hangs forever.
The tool leverages Apache™ OODT to parllelize ane workflow together the following components:
- Apache™ SOLR based exploration of a CM repository (e.g., Git, SVN, etc.) and classification of that repository based on MIME type using Apache™ Tika.
- A MIME partitioner that uses Apache™ Tika to automatically deduce and classify by file type and then partition Apache™ RAT jobs based on sets of 100 files per type (configurable) -- the M/R "partitioner"
- A throttle wrapper for RAT to MIME targeted Apache™ RAT. -- the M/R "mapper"
- A reducer to "combine" the produced RAT logs together into a global RAT report that can be used for stats generation. -- the M/R "reducer"
How to Build
You can build DRAT in a few steps:
mkdir -p /usr/local/xdata-code-audit/deploy
mkdir -p /usr/local/xdata-code-audit/src
cd /usr/local/xdata-code-audit/
git clone https://github.com/chrismattmann/drat.git
mv drat src && cd src
mvn install
cp -R target/distribution/dms-distribution-0.1-bin.tar.gz deploy
cd deploy
tar xvzf dms-distribution-0.1-bin.tar.gz
rm -rf *.tar.gz
cp -R ../src/pge ./pge && cp -R ../src/solr/ ./solr
How to Run
Here are the basic commands to run DRAT. Imagine you had a code repo, your-repo, that lives in $HOME/your-repo
.
-
Start Apache™ OODT
cd /usr/local/xdata-code-audit/deploy
cd filemgr/bin && ./filemgr start
cd ../../workflowbin/ && ./wmgr start
-
Crawl the repository of interest, e.g.,
$HOME/your-repo
:
cd /usr/local/xdata-code-audit/deploy/crawler/bin
./crawler_launcher --operation --metPC --productPath $HOME/your-repo --metExtractorConfig /usr/local/xdata-code-audit/deploy/extractors/code/default.cpr.conf --metExtractor org.apache.oodt.cas.metadata.extractors.CopyAndRewriteExtractor --filemgrUrl http://localhost:9000 --clientTransferer org.apache.oodt.cas.filemgr.datatransfer.InPlaceDataTransferFactory
-
Index the crawled repo in Apache™ SOLR:
cd /usr/local/xdata-code-audit/deploy/filemgr/bin
java -Djava.ext.dirs=../lib -DSOLR_INDEXER_CONFIG=../etc/indexer.properties org.apache.oodt.cas.filemgr.tools.SolrIndexer --all --fmUrl http://localhost:9000 --optimize --solrUrl http://localhost:8080/xdatagitsolr/xdatagit
-
Fire off the partitioner and mappers
cd /usr/local/xdata-code-audit/deploy/workflow/bin
./wmgr-client --url http://localhost:9001 --operation --dynWorkflow --taskIds urn:xdata:MimePartitioner
-
Fire off the reducer
cd /usr/local/xdata-code-audit/deploy/workflow/bin
./wmgr-client --url http://localhost:9001 --operation --dynWorkflow --taskIds urn:xdata:RatAggregator