def retrieve(self, total_no_of_issues, already_parsed): start = 0 count = 0 if already_parsed > 0: logger_parse.info("Retrieving issues starting from %s", already_parsed) logger_parse.info("Total no of issues to be parsed are %s", total_no_of_issues) start = int(already_parsed) count = int(already_parsed) try: while count < total_no_of_issues: issues = self.search(total_no_of_issues, start) logger_parse.info("Iterating over results now. Starting from %s", start) if issues is not None: for key in issues: json_data = self.get_issue_detail(key) self.file.write_data_file(json_data, key) count += 1 start = count self.file.write_status_file(self.prj, count, total_no_of_issues, "") else: logger_parse.info("No more issues to be parsed") except SSLError as err: logger_parse.error("Encountered Exception while processing the issues. Writing error to the status file.") self.file.write_status_file(self.prj, count, total_no_of_issues, err) logger_parse.info("Parsing complete")
def __init__(self, prj_name, jira, dirname): logger_parse.info(" Initializing Parse ") self.prj = prj_name self.jira = jira self.dir= dirname self.file = File() self.conn = ConnectionPoolManager()
def parse(self): logger_parse.info("Parsing started....") self.file.create_dir_if_not_exist(self.dir) status_data = self.file.read_status_json_if_exists(self.dir) issues_parsed = 0 if not status_data is None: issues_parsed = status_data['total_no_of_issues_parsed'] logger_parse.info("Issues parsed so far are :- %s", issues_parsed) proj = self.jira.project(self.prj) issues_info = self.jira.search_issues(self.get_query_string(), maxResults=0, fields=['total'], json_result=True) logger_parse.info("Total no of issues are %s", str(issues_info['total'])) total_no_of_issues = issues_info['total'] self.retrieve(total_no_of_issues, issues_parsed)