Add run_failure_rate argument to specify values to use in graph
This This commit adds a new flag to the run_failure_rate command in subunit2sql-graph. It expects a comma separated list on the cli and it will only graph the bar for runs which have a metadata value that is in the list provided. This is useful if you only want to view a subset of values grouped under a key. Change-Id: I70b7d34bd027ee2a6f7e75fc0cef5a39ddcda3ef
This commit is contained in:
		
							
								
								
									
										
											BIN
										
									
								
								doc/source/graph-run_failure_rate.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								doc/source/graph-run_failure_rate.png
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							| After Width: | Height: | Size: 321 KiB | 
| @@ -158,6 +158,28 @@ for a given run_metadata key to make the graph useful. To workaround this you | |||||||
| specify a list of values that will be used to filter the output so that only | specify a list of values that will be used to filter the output so that only | ||||||
| matches of that key will be in the output. | matches of that key will be in the output. | ||||||
|  |  | ||||||
|  |  | ||||||
|  | Run Failure Rate Grouped By Run Metadata | ||||||
|  | ---------------------------------------- | ||||||
|  |  | ||||||
|  | This graph generates a bar chart to show the failure rates for all runs for | ||||||
|  | with a run_metadata value for a user provided run_metadata key. | ||||||
|  |  | ||||||
|  | For example, running something like:: | ||||||
|  |  | ||||||
|  |   subunit2sql-graph --title "Failure Ratess by Job Name" --database-connection mysqll://test:test@localhost/subunit2sql -o test.png run_failure_rate build_name --filter_list gate-tempest-dsvm-neutron-full-ssh,gate-tempest-dsvm-full-ubuntu-xenial,gate-tempest-dsvm-full-ubuntu-trusty,gate-tempest-dsvm-py35-ubuntu-xenial | ||||||
|  |  | ||||||
|  | will generate a graph like: | ||||||
|  |  | ||||||
|  | .. image:: graph-run_failure_rate.png | ||||||
|  |    :width: 115% | ||||||
|  |  | ||||||
|  | It's also worth noting the --filter_list argument used in the command above. | ||||||
|  | In some cases, especially larger data sets, there are too many distinct values | ||||||
|  | for a given run_metadata key to make the graph useful. To workaround this you | ||||||
|  | specify a list of values that will be used to filter the output so that only | ||||||
|  | matches of that key will be in the output. | ||||||
|  |  | ||||||
| subunit2sql-graph plugin interface | subunit2sql-graph plugin interface | ||||||
| ================================== | ================================== | ||||||
|  |  | ||||||
|   | |||||||
| @@ -26,10 +26,16 @@ matplotlib.style.use('ggplot') | |||||||
| def set_cli_opts(parser): | def set_cli_opts(parser): | ||||||
|     parser.add_argument('metadata_key', |     parser.add_argument('metadata_key', | ||||||
|                         help="The run_metadata key to group the runs by") |                         help="The run_metadata key to group the runs by") | ||||||
|  |     parser.add_argument('--filter_list', '-f', | ||||||
|  |                         help='A comma seperated list of values to use') | ||||||
|  |  | ||||||
|  |  | ||||||
| def generate_series(): | def generate_series(): | ||||||
|     session = api.get_session() |     session = api.get_session() | ||||||
|  |     if CONF.command.filter_list: | ||||||
|  |         filter_list = CONF.command.filter_list.split(',') | ||||||
|  |     else: | ||||||
|  |         filter_list = [] | ||||||
|     if CONF.start_date: |     if CONF.start_date: | ||||||
|         start_date = datetime.datetime.strptime(CONF.start_date, '%Y-%m-%d') |         start_date = datetime.datetime.strptime(CONF.start_date, '%Y-%m-%d') | ||||||
|     else: |     else: | ||||||
| @@ -45,6 +51,8 @@ def generate_series(): | |||||||
|  |  | ||||||
|     perc_data = {} |     perc_data = {} | ||||||
|     for key in run_status: |     for key in run_status: | ||||||
|  |         if key not in filter_list: | ||||||
|  |             continue | ||||||
|         if run_status[key].get('pass'): |         if run_status[key].get('pass'): | ||||||
|             pass_num = float(run_status[key]['pass']) |             pass_num = float(run_status[key]['pass']) | ||||||
|         else: |         else: | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Matthew Treinish
					Matthew Treinish