Changes between Version 38 and Version 39 of AnalyzePlugin


Ignore:
Timestamp:
Jun 3, 2015, 12:22:18 PM (9 years ago)
Author:
figaro
Comment:

Cosmetic changes

Legend:

Unmodified
Added
Removed
Modified
  • AnalyzePlugin

    v38 v39  
    11[[PageOutline(2-5,Contents,pullout)]]
    22
    3 = Analyzes tickets for dependency and other problems =
    4 
    5 == Description ==
    6 
    7 This is an extensible analysis tool for analyzing tickets in reports.  This plugin requires !JavaScript and [http://jqueryui.com/ jquery-ui] (included) for the dialog modals.  This plugin currently has four built-in analyses:
    8 
    9  1. '''Milestone Dependency Analysis''' - ensures dependent tickets are in current or prior milestones
    10  1. '''Queue Dependency Analysis''' - ensures dependent ''peer'' tickets in a queue are ordered correctly
    11  1. '''Project Queue Analysis''' - ensures dependent ''child'' tickets of parent tickets in a queue follow the parents' ordering
    12  1. '''Project Rollup Analysis''' - summarizes (or rolls up) the child tickets' fields in the parent ticket
    13 
    14 All of the analyses above build upon the [wiki:MasterTicketsPlugin master tickets plugin].  The second and third analyses also build upon the [wiki:QueuesPlugin queues plugin].  (Be sure to use the latest version of the queues plugin so that the included jquery-ui versions match to avoid conflicts!)  See below for examples.
     3= Analyzes tickets for dependency and other problems
     4
     5== Description
     6
     7This is an extensible analysis tool for analyzing tickets in reports. This plugin requires !JavaScript and [http://jqueryui.com/ jquery-ui] (included) for the dialog modals. This plugin currently has the following built-in analyses:
     8
     9 1. '''Milestone Dependency Analysis''' - ensures dependent tickets are in current or prior milestones.
     10 1. '''Queue Dependency Analysis''' - ensures dependent ''peer'' tickets in a queue are ordered correctly.
     11 1. '''Project Queue Analysis''' - ensures dependent ''child'' tickets of parent tickets in a queue follow the parents' ordering.
     12 1. '''Project Rollup Analysis''' - summarizes (or rolls up) the child tickets' fields in the parent ticket.
     13
     14All of the analyses above build upon the [wiki:MasterTicketsPlugin master tickets plugin]. The second and third analyses also build upon the [wiki:QueuesPlugin queues plugin]. Be sure to use the latest version of the queues plugin so that the included jquery-ui versions match to avoid conflicts!
     15
     16See below for examples.
    1517
    1618[[Image(ask_analyze.png)]]
    1719
    18 == Configuration ==
    19  1. Install the plugin (after downloading and unzipping):
    20     {{{
    21     #!sh
    22     cd analyzeplugin/0.12
    23     sudo python setup.py bdist_egg
    24     sudo cp dist/TracAnalyze*.egg /your/trac/location/plugins/
    25     }}}
    26 
    27     See [http://trac.edgewall.org/wiki/TracPlugins TracPlugins] for more installation details and options.  You'll likely need to restart Trac's web server after installation.
    28 
    29  2. Enable the plugin:
    30     {{{
    31     #!sh
    32     [components]
    33     analyze.* = enabled
    34     }}}
    35 
    36     You can alternatively use the Trac Web Admin GUI to enable any or all rules.
    37 
    38  3. Enable the {{{ANALYZE_VIEW}}} permission for those users who are allowed to execute analyses.
    39 
    40 See the examples section [wiki:AnalyzePlugin#Examples below] for how to specify rules.
    41 
    42 
    43 == Bugs/Feature Requests ==
     20== Bugs/Feature Requests
    4421
    4522Existing bugs and feature requests for AnalyzePlugin are
     
    4724
    4825If you have any issues, create a
    49 [http://trac-hacks.org/newticket?component=AnalyzePlugin&owner=robguttman new ticket].
    50 
    51 == Download ==
     26[/newticket?component=AnalyzePlugin new ticket].
     27
     28[[TicketQuery(component=AnalyzePlugin&group=type,format=progress)]]
     29
     30== Download
    5231
    5332Download the zipped source from [download:analyzeplugin here].
    5433
    55 == Source ==
     34== Source
    5635
    5736You can check out AnalyzePlugin from [http://trac-hacks.org/svn/analyzeplugin here] using Subversion, or [source:analyzeplugin browse the source] with Trac.
    5837
    59 == Example ==
    60 
    61 This plugin currently includes four analyses that can each be individually enabled for one or more reports.  Each analysis is configured by modifying the {{{[analyze]}}} section of {{{trac.ini}}} - see below for examples.  When an analysis is enabled for a report, an '''Analyze...''' button appears at the top of the report and the analysis' name will appear in the subsequent dialog box when the button is clicked.  You can either choose a single analysis or all analyses in this dialog box.  Selecting "All" will run them serially.
    62 
    63 '''Important:''' The current analyses are powerful and yet are limited.  They do not, for example, detect circular dependencies nor can they handle complex relationships all in one pass.  What this means is that after a pass of fixes, the changes may have caused or exposed other issues that another analysis pass will uncover.  So the general usage pattern is to continue re-running analyses until "quiescence" is reached - i.e., until there are no more issues to fix.
    64 
    65 ==== Milestone Dependency Analysis ====
    66 The popular [wiki:MasterTicketsPlugin master tickets plugin] enables specifying dependencies amongst tickets and visualizes them via graphviz.  However, the plugin doesn't include support to manage these dependencies such as detecting when tickets are scheduled out of order.  That's where this Milestone Dependency Analysis comes in.
     38== Installation and Configuration
     39
     40 1. Download and unzip the plugin.
     41 2. Install the plugin:
     42 {{{#!sh
     43cd analyzeplugin/0.12
     44sudo python setup.py bdist_egg
     45sudo cp dist/TracAnalyze*.egg /your/trac/location/plugins/
     46}}}
     47
     48 See [t:TracPlugins TracPlugins] for more installation details and options. You'll likely need to restart Trac's web server after installation.
     49
     50 3. Enable the plugin by adding the following to your `trac.ini` file:
     51 {{{#!ini
     52[components]
     53analyze.* = enabled
     54}}}
     55
     56 You can alternatively use the Trac Web Admin GUI to enable any or all rules.
     57
     58 4. Enable the {{{ANALYZE_VIEW}}} permission for those users who are allowed to execute analyses.
     59
     60See the examples section [wiki:AnalyzePlugin#Examples below] for how to specify rules.
     61
     62== Example
     63
     64This plugin currently includes four analyses that can each be individually enabled for one or more reports. Each analysis is configured by modifying the {{{[analyze]}}} section of {{{trac.ini}}} - see below for examples. When an analysis is enabled for a report, an '''Analyze...''' button appears at the top of the report and the analysis' name will appear in the subsequent dialog box when the button is clicked. You can either choose a single analysis or all analyses in this dialog box. Selecting "All" will run them serially.
     65
     66'''Important:''' The current analyses do not, for example, detect circular dependencies nor can they handle complex relationships all in one pass. This means that after a pass of fixes, the changes may have caused or exposed other issues that another analysis pass will uncover. So the general usage pattern is to continue re-running analyses until "quiescence" is reached, ie until there are no more issues to fix.
     67
     68==== Milestone Dependency Analysis
     69
     70The popular [wiki:MasterTicketsPlugin master tickets plugin] enables specifying dependencies amongst tickets and visualizes them via graphviz.  However, the plugin doesn't include support to manage these dependencies such as detecting when tickets are scheduled out of order. That's where this Milestone Dependency Analysis comes in:
    6771
    6872[[Image(issue-milestone.png)]]
    6973
    70 This analysis detects when a ticket in a given report has a dependency (a {{{blockedby}}} ticket) that is in a future milestone (or not scheduled in any milestone). This works with either of the following semantics for {{{blockedby}}} tickets:
     74This analysis detects when a ticket in a given report has a dependency (a {{{blockedby}}} ticket) that is in a future milestone or not scheduled in any milestone. This works with either of the following semantics for {{{blockedby}}} tickets:
    7175
    7276 * {{{blockedby}}} tickets are ''peer'' ordering relationships
     
    7478
    7579To enable this analysis for a given report, list those reports in {{{trac.ini}}} as follows:
    76 {{{
    77 #!ini
     80{{{#!ini
    7881[analyze]
    7982milestone_reports = 1,9
     
    8285Detected problems are shown with an option to automatically fix the problem by moving tickets into appropriate milestones - see screenshot above.
    8386
    84 ==== Queue Dependency Analysis ====
    85 The [wiki:QueuesPlugin queues plugin] converts one or more reports into work queues.  These queues enable you to drag and drop tickets above and below one another signifying their relative priority.  Each ticket's relative position is maintained in a custom field usually named {{{position}}} (but can be named anything).  Dependencies amongst peer tickets in a work queue have similar problems as tickets across milestones - in this case, a dependent ticket should precede (i.e., appear higher in the queue which means have a lower {{{position}}} value), but it can be difficult to manually catch all of these dependency violations.  That's where this Queue Dependency Analysis comes in.
     87==== Queue Dependency Analysis
     88
     89The [wiki:QueuesPlugin queues plugin] converts one or more reports into work queues. These queues enable you to drag and drop tickets above and below one another signifying their relative priority.  Each ticket's relative position is maintained in a custom field usually named {{{position}}} (but can be named anything). Dependencies amongst peer tickets in a work queue have similar problems as tickets across milestones - in this case, a dependent ticket should precede, ie appear higher in the queue which means have a lower {{{position}}} value, but it can be difficult to manually catch all of these dependency violations. That's where this Queue Dependency Analysis comes in:
    8690
    8791[[Image(issue-queue.png)]]
    8892
    89 This analysis detects when a ticket in a given report has a dependency (a {{{blockedby}}} ticket) whose {{{position}}} comes after this ticket's (or has no {{{position}}} yet at all, or is not in the correct queue).  To enable this analysis for a given report, list those reports in {{{trac.ini}}} as follows:
    90 {{{
    91 #!ini
     93This analysis detects when a ticket in a given report has a dependency, for example a {{{blockedby}}} ticket, whose {{{position}}} comes after this ticket's or has no {{{position}}} yet at all, or is not in the correct queue. To enable this analysis for a given report, list those reports in {{{trac.ini}}} as follows:
     94{{{#!ini
    9295[analyze]
    9396queue_reports = 2,9
     
    9598}}}
    9699
    97 The {{{queue_fields}}} (optional) above tells this analysis what fields (if any) define (i.e., segment) a queue.  Queues can be defined by zero or more fields such as the {{{milestone}}} field, a custom {{{queue}}} field, both or other fields.  If you have different reports using different definitions, you can define report-specific queue field definitions as follows:
    98 {{{
    99 #!ini
     100The {{{queue_fields}}} (optional) above tells this analysis what fields (if any) define (i.e., segment) a queue. Queues can be defined by zero or more fields such as the {{{milestone}}} field, a custom {{{queue}}} field, both or other fields. If you have different reports using different definitions, you can define report-specific queue field definitions as follows:
     101{{{#!ini
    100102[analyze]
    101103queue_fields.9 = queue
     
    103105
    104106In this example, report 2 uses both {{{queue}}} and {{{milestone}}} fields to define a queue whereas report 9 uses only the {{{queue}}} field.  You may also specify additional filters to skip tickets with certain field values (pipe-delimited):
    105 {{{
    106 #!ini
     107{{{#!ini
    107108[analyze]
    108109queue_fields.9 = queue,type!=epic,phase!=verifying|releasing
    109110}}}
    110111
    111 In this example, the {{{queue}}} field defines the queue in report 9 and the analysis will skip any ticket in this queue with {{{type}}} equal to "epic" or {{{phase}}} equal to "verifying" or "releasing".  (These would typically match the {{{WHERE}}} clause in the report's SQL.)
     112In this example, the {{{queue}}} field defines the queue in report 9 and the analysis will skip any ticket in this queue with {{{type}}} equal to "epic" or {{{phase}}} equal to "verifying" or "releasing".  These would typically match the {{{WHERE}}} clause in the report's SQL.
    112113
    113114Detected problems are shown with an option to automatically fix the problem by moving tickets above or below each other in the queue - see screenshot above.
    114115
    115 ==== Project Queue Analysis ====
    116 This analysis is for ''project'' queues (instead of work queues) meaning that the dependency semantics is parent-child.  For example, you may have a report of project (or "epic" in agile-speak) tickets whose sub-tasks are represented in their {{{blockedby}}} dependencies.  Re-prioritizing a project/epic/parent ticket does not automatically re-order their child tickets, respectively.  That's where this Project Queue Analysis comes in.
     116==== Project Queue Analysis
     117
     118This analysis is for ''project'' queues (instead of work queues) meaning that the dependency semantics is parent-child. For example, you may have a report of project (or "epic" in agile-speak) tickets whose sub-tasks are represented in their {{{blockedby}}} dependencies. Re-prioritizing a project/epic/parent ticket does not automatically re-order their child tickets, respectively. That's where this Project Queue Analysis comes in:
    117119
    118120[[Image(issue-project.png)]]
    119121
    120 This analysis will enforce that the child tickets (usually found in a separate work queue report) are ordered relative to one another in the same general order as the parent/project tickets.  To enable this analysis for a given report, list those reports in {{{trac.ini}}} as follows:
    121 {{{
    122 #!ini
     122This analysis will enforce that the child tickets (usually found in a separate work queue report) are ordered relative to one another in the same general order as the parent/project tickets. To enable this analysis for a given report, list those reports in {{{trac.ini}}} as follows:
     123{{{#!ini
    123124[analyze]
    124125project_reports = 19
     
    128129}}}
    129130
    130 The {{{project_type}}} option above is the ticket type of your projects (e.g., "epic" (the default), "project", etc.).  Project tickets must be of this type.
    131 
    132 The default behavior of an analysis is to refresh the current report if any fixes were made.  This is so that changes can be viewed (assuming they would change the content of the report).  In the case of the Project Queue Analysis, you would usually also need another report refreshed - i.e., the impacted work queue.  Use the {{{refresh_report}}} option to specify this impacted work queue which will also get refreshed at the end of this analysis if there were any fixes.  You can add params to the report as well if needed:
    133 {{{
    134 #!ini
     131The {{{project_type}}} option above is the ticket type of your projects, eg "epic" (the default), "project", etc. Project tickets must be of this type.
     132
     133The default behavior of an analysis is to refresh the current report if any fixes were made. This is so that changes can be viewed (assuming they would change the content of the report. In the case of the Project Queue Analysis, you would usually also need another report refreshed - ie the impacted work queue. Use the {{{refresh_report}}} option to specify this impacted work queue which will also get refreshed at the end of this analysis if there were any fixes. You can add params to the report as well if needed:
     134{{{#!ini
    135135[analyze]
    136136refresh_report = 9?max=1000
     
    139139This analysis uses the same queue fields configuration as the Queue Dependency Analysis above.
    140140
    141 Detected problems are shown with an option to automatically fix the problem by moving the sub-task/child tickets above or below each other in their queue (to match their parent's relative positions) - see screenshot above.
    142 
    143 ==== Project Rollup Analysis ====
    144 This analysis summarizes a project by "rolling up" its child tickets using one of several statistical methods.  For example, you may have a report of project (or "epic" in agile-speak) tickets whose sub-tasks are represented in their {{{blockedby}}} dependencies.  You would like each project ticket's fields to summarize (or roll up) those of its child tickets.  That's where this Project Rollup Analysis comes in.
     141Detected problems are shown with an option to automatically fix the problem by moving the sub-task/child tickets above or below each other in their queue (to match their parent's relative positions), see screenshot above.
     142
     143==== Project Rollup Analysis
     144
     145This analysis summarizes a project by "rolling up" its child tickets using one of several statistical methods. For example, you may have a report of project (or "epic" in agile-speak) tickets whose sub-tasks are represented in their {{{blockedby}}} dependencies. You would like each project ticket's fields to summarize (or roll up) those of its child tickets. That's where this Project Rollup Analysis comes in:
    145146
    146147[[Image(rollup-project.png)]]
    147148
    148149To enable this analysis for reports, list those reports in {{{trac.ini}}} as follows:
    149 {{{
    150 #!ini
     150{{{#!ini
    151151[analyze]
    152152rollup_reports = 1,2,3,9
     
    163163 * pivot
    164164
    165 All but {{{pivot}}} apply to numeric fields, and all but {{{sum}}} apply to select option fields.  Here are several examples of specifying a stat for different fields:
    166 {{{
    167 #!ini
     165All but {{{pivot}}} apply to numeric fields, and all but {{{sum}}} apply to select option fields. Here are several examples of specifying a stat for different fields:
     166{{{#!ini
    168167 [analyze]
    169168 rollup.effort = sum
     
    188187Detected changes to rollup field values are shown with an option to automatically update the value - see screenshot above.
    189188
    190 == Tips! ==
     189== Tips and hints
     190
    191191A few ideas to optimize your analysis experience:
    192192 * If this tool's ticket changes generate emails that are of little value to your team, then you can quiet them by enabling "Quiet Mode" using the [wiki:QuietPlugin Quiet Plugin].
    193  * Use !TicketQuery in a project/epic's description to see all of its sub-tasks/children.  Here's an example that allows you to order by position as the first column and the ticket id as the second. The {{{1234}}} is the project/epic's ticket number:
     193 * Use !TicketQuery in a project/epic's description to see all of its sub-tasks/children. Here is an example that allows you to order by position as the first column and the ticket id as the second. The {{{1234}}} is the project/epic's ticket number:
    194194 {{{
    195195 [[TicketQuery(blocking~=1234,format=table,col=position|id|summary|severity|owner|effort|milestone|phase,order=position,group=type)]]
    196196 }}}
    197  * The core analyses are maintained in python modules that require no imports.  This was intentional so that they may be easily wrapped and called from a monitoring script (e.g., [https://github.com/trifthen/NagAconda nagaconda] for nagios) so that you can be proactively alerted to ticket scheduling issues without needing to manually run analyses in Trac.
    198 
    199 == Extensibility (implementation details) ==
    200 Each analysis is implemented as a Trac extension point to allow for new analyses to be added fairly easily.  See [browser:analyzeplugin/0.12/analyze/analysis.py analysis.py] for the {{{IAnalysis}}} interface.  In brief, you only need to define two methods for each analysis:
     197 * The core analyses are maintained in python modules that require no imports.  This was intentional so that they may be easily wrapped and called from a monitoring script, eg [https://github.com/trifthen/NagAconda nagaconda] for nagios, so that you can be proactively alerted to ticket scheduling issues without needing to manually run analyses in Trac.
     198
     199== Extensibility (implementation details)
     200
     201Each analysis is implemented as a Trac extension point to allow for new analyses to be added fairly easily. See [browser:analyzeplugin/0.12/analyze/analysis.py analysis.py] for the {{{IAnalysis}}} interface. In brief, you only need to define two methods for each analysis:
    201202
    202203 * {{{can_analyze(self, report)}}} - returns {{{True}}} if this analysis can analyze the given report
    203204 * {{{get_solutions(self, db, args)}}} - return a dict of {{{name}}} and {{{data}}} fields, or a list of these, that each define a solution option for how to fix the detected issue.
    204205
    205 where {{{args}}} are the request args and {{{data}}} is any serializable (to JSON) python object that contains all of the data needed to automatically fix the problem.  If this {{{data}}} object is a dict of ticket fields and their new values (or a list of these), then the default {{{fix_issue()}}} method will automatically apply the fix upon user command. If your fix is more involved, you can override this method:
     206where {{{args}}} are the request args and {{{data}}} is any serializable (to JSON) python object that contains all of the data needed to automatically fix the problem. If this {{{data}}} object is a dict of ticket fields and their new values (or a list of these), then the default {{{fix_issue()}}} method will automatically apply the fix upon user command. If your fix is more involved, you can override this method:
    206207
    207208 * {{{fix_issue(self, db, data, author)}}} - fix the issue using the data that was returned earlier from {{{get_solutions()}}}.
     
    209210See the code for examples and other smaller tweaks to the {{{IAnalysis}}} interface and base {{{Analysis}}} class.
    210211
    211 == Recent Changes ==
     212== Recent Changes
    212213
    213214[[ChangeLog(analyzeplugin, 3)]]
    214215
    215 == Author/Contributors ==
     216== Author/Contributors
    216217
    217218'''Author:''' [wiki:robguttman] [[BR]]
    218 '''Maintainer:''' [wiki:robguttman] [[BR]]
     219'''Maintainer:''' [[Maintainer]] [[BR]]
    219220'''Contributors:'''