forked from cms-sw/cmssw
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added a simple script to generate a json file with the categories
- Loading branch information
Showing
1 changed file
with
42 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
#!/usr/bin/env python | ||
|
||
from categories import CMSSW_CATEGORIES, CMSSW_L2, CMSSW_L1 | ||
import json | ||
# Generates a json file sumarizing the categories, their packages, and conveners | ||
# it asumes that categories.py from https://raw.githubusercontent.com/cms-sw/cms-bot/HEAD/categories.py | ||
# is already downloaded | ||
|
||
# ------------------------------------------------------------------------------ | ||
# Global Variables | ||
# ----------------------------------------------------------------------------- | ||
OUTPUT_FILE = 'categories.json' | ||
|
||
# ------------------------------------------------------------------------------ | ||
# Start of execution | ||
# ----------------------------------------------------------------------------- | ||
|
||
all_categories = CMSSW_CATEGORIES.keys() | ||
# schema of categories_to_people: | ||
# { | ||
# "<category>" : [ "<person1>" , "person2" , ... , "personN" ] | ||
# } | ||
categories_to_people = {} | ||
|
||
for person in CMSSW_L2.keys(): | ||
categories = CMSSW_L2[ person ] | ||
for cat in categories: | ||
if not categories_to_people.get( cat ): | ||
categories_to_people[ cat ] = [] | ||
categories_to_people[ cat ].append( person ) | ||
|
||
print '----------------' | ||
print categories_to_people | ||
|
||
output = {} | ||
output[ 'categories_to_people' ] = categories_to_people | ||
output[ 'categories_to_packages' ] = CMSSW_CATEGORIES | ||
output[ 'L1' ] = CMSSW_L1 | ||
|
||
out_json = open( OUTPUT_FILE , "w" ) | ||
json.dump( output , out_json , indent=4 ) | ||
out_json.close() |