We are going to read certain fields: issue’s type, creation date and time, resolution date and time, reporter, assignee, status. Before giving example, suppose we want to read unknown number of issues belonging projects ‘Project1’ and ‘Project2’ and created during the last 365 days. ‘While’ loop may be used for iterative reading data. In this case, we can avoid mentioned problems and not think about number of issues in Jira. So, it’s a good way to read data iteratively, chunk by chunk. Moreover, we would like to avoid possible overload Jira’s server by reading a big piece of data at once. As a rule, we don’t know how many issues we will read from Jira’s server. Maximum number of issue resources in ResultList Jira’s server returns is limited by number of results configured in a server.
As an example in the code above, we read status name of the first issue.
First youll need to install the python-rest-client package. Create a new directory to write your client in and cd into it.
Note that the default version on Mac OS X 10.6 is 2.5. This tutorial assumes that you have Python 2.6.3 installed. Iterating over this ResultList, issue’s fields can be extracted. Well write a Python script which lists the users who are uncompleted reviewers of at least one open review. jira_search has type - a list of issue resources matching a JQL, for example: Where jql - Jira Query Language finds issues corresponding conditions given in a query. After installing this library, we import the following object and exception as well as create instance of the imported object: Jira-python library allows us to easily communicate with Jira APIs. Nevertheless, we don’t know in advance how much data in Jira (maybe somebody really meets large volumes of data) and it’s a good practice to process data chunk by chunk. No, we are not going to consider Big Data tools. Reading data from Jira in a ‘big data’ manner Visualizing data by using python’s networkx library and graph visualization tool Gephi.Reading information from Jira by using jira-python library.This may be interesting in terms of finding patterns, potential problems, improving business processes and increasing efficiency of using Jira or simply taking ‘bird’s-eye view’ how communication flows in Jira. Logging.basicConfig(level=logging.There is a lot communications information in issues, for example, authors, assignees, descriptions, comments, statuses. Logfile =datetime.now().strftime( 'c:\\temp\\JIRACustomFieldUpdate_%Y%m%d%H%M.log') Issue.update(fields='.format(k_old,fnupdate))ĭef main (): from datetime import datetime #bug('running with %s and %s', self.args, self.kwargs) if o= "str": Threading.Thread._init_(self, group=group, target=target, name=name) ThreadLimiter = threading.BoundedSemaphore( 10)Ĭlass JIRAThreadWithArgs (threading.Thread): """thread worker function""" def _init_ (self, group=None, target=None, name=None,args= (), kwargs=None): #logging.basicConfig(level=logging.DEBUG,format='(%(threadName)-10s) %(message)s',) #set multi thread = 10 Sql += " order by, customfield" return sql
#sql select queue def selectsql (key, cfname):
In my case, I have a JIRA custom fields mapping table to refer and get its corresponding data from MSSQL database and update JIRA fields accordingly. Here is a workable python3 code for update the custom fields I wrote for an EPM. JIRA provides a RESTful API and it is quite easy to code in Python the do this job. In this case, you can use JIRA API to update this information.
for example, you have a client in JIRA, and you need to get the client detail from your database to assist your business process. Ī lot of situations that workflow needs to enrich its data from the business source. for the detail, please refer to this link. it can be tailored to match how your team works. JIRA is a great tool for workflows and it has a good flexibility of custom configuration.