-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprocessing_data.py
38 lines (28 loc) · 990 Bytes
/
processing_data.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import stackquery.libs.gerrit as gerrit
from stackquery.models.project import Project
import logging
import argparse
LOG = logging.getLogger(__name__)
def init_argparse():
parser = argparse.ArgumentParser(description='Processing gerrit changes')
parser.add_argument('--debug', action='store_true',
help='Show debug message', default=False)
parser.add_argument('--project', help='Run for an specific project',
default=None)
return parser.parse_args()
import logging
LOG = logging.getLogger(__name__)
def main():
args = init_argparse()
if args.debug:
logging.basicConfig(level=logging.DEBUG)
if args.project:
projects = [Project.query.filter_by(name=args.project).first()]
else:
projects = Project.query.all()
if len(projects) is 0:
print 'Project not found'
for project in projects:
gerrit.process_reviews(project)
if __name__ == '__main__':
main()