'Python JIRA jira.issue slow performance
I am trying to retrieve from JIRA tree graph of parent child issues epic->story->task using python3.10 jira=3.1.1
for project with 400 issues it takes minutes to retrieve the result.
is there a way how to improve this code for better performance
The result is displayed in flask frontend web and response time 2minutes is not pleasant for users
jira = JIRA(options={'server': self.url, 'verify': False}, basic_auth=(self.username, self.password))
for singleIssue in jira.search_issues(jql_str=querystring, maxResults=False):
issue = jira.issue(singleIssue.key)
links = issue.fields.issuelinks
for link in links:
if hasattr(link, 'inwardIssue'):
item['inward_issue'] = link.inwardIssue.key
if hasattr(link, 'outwardIssue'):
item['outward_issue'] = link.outwardIssue.key
item['typename'] = link.type.nam
Solution 1:[1]
I realised this is moreless matter of flask and long queries handling. It should be solved either by asynchronous calls or queuing.
Solution 2:[2]
Limit the fields you are requesting via the "fields=[ 'key' ]
" parameter to include only those which you need.
In your example you are fetching the whole issue twice: once from the .search_issues()
iterator every time round the loop (as expected), and (unnecessarily) again in the .issue()
call on the following line.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Petr Simik |
Solution 2 |