Created
December 10, 2013 02:15
-
-
Save mpkocher/7884771 to your computer and use it in GitHub Desktop.
scrape attributes/metrics from job json report files.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
import os | |
import json | |
import glob | |
def scrape_from_report(p): | |
with open(p, 'r') as f: | |
s = f.read() | |
d = json.loads(s) | |
print "rules from {p}".format(p=os.path.basename(p)) | |
for k in d['attributes']: | |
print ' '.join([k['id'].split('.')[-1], '= ExactRule()']) | |
def scrape_from_job_dir(d): | |
json_reports = glob.glob("{d}/results/*.json".format(d=d)) | |
for json_report in json_reports: | |
#print json_report | |
scrape_from_report(json_report) | |
def main(): | |
d = '/mnt/secondary-siv/nightlytest/siv3/smrtanalysis/common/jobs/016/016443' | |
scrape_from_job_dir(d) | |
return 0 | |
if __name__ == '__main__': | |
sys.exit(main()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment