Skip to content

Flask Grafana Feature Request

Alex Bara edited this page Jul 19, 2021 · 8 revisions

Create Grafana-Flask interface to enable Tuna DB querying.

Tuna users currently do not have a way to get information from the Tuna DB. User should be able to easily get questions answered, such as 'What are changes in kernel time for a specific MIOpenDriver cmd over time?' [TBD other examples].

Users should have a way to select options through the Grafana interface and receive answers in graphs, time-series or plain data displays.

Proposal

Implement a Grafana-Flask application interface that allows Tuna users to query the DB based on desired criteria(arch, num_cu, solver, MIOpenDriver cmd etc.) and instantly receive results.

Implementation

Features to be implemented in this order:

  1. Allow user to enter an MIOpenDriver cmd, select arch, num_cu, solver (optional) and receive find_db information on how kernel_time has changed over time for this specific request. This should include all 3 directions: F, B, W for the kernel time for a specific MIOpenDriver cmd. If the user does not select the solver, Grafana will plot the best solver for each rocm/miopen version. If the user does select a solver, Grafana will plot the specific solver for each distinct rocm/miopen version.
  • Grafana will send a request(json) to Flask to get data(json) to plot in a timeseries table using http:///search Sample:
REQUEST
{'app': 'explore', 'dashboardId': 0, 'timezone': 'browser', 'startTime': 1625065845622, 'interval': '2h', 'intervalMs': 7200000, 'panelId': 'Q-f7e5ffbd-7c21-4c81-9395-aef44f87c7d3-0', 'targets': [{'target': './bin/MIOpenDriver conv -n 128 -c 1024 -H 14 -W 14 -k 2048 -y 1 -x 1 -p 0 -q 0 -u 2 -v 2 -l 1 -j 1 -m conv -g 1 -F 1 -t 1', 'refId': 'A', 'type': 'timeserie'}], 'range': {'from': '2021-06-30T19:09:19.000Z', 'to': '2021-09-30T19:09:19.000Z', 'raw': {'from': '2021-06-30T19:09:19.000Z', 'to': '2021-09-30T19:09:19.000Z'}}, 'requestId': 'explore', 'rangeRaw': {'from': '2021-06-30T19:09:19.000Z', 'to': '2021-09-30T19:09:19.000Z'}, 'scopedVars': {'__interval': {'text': '2h', 'value': '2h'}, '__interval_ms': {'text': 7200000, 'value': 7200000}}, 'maxDataPoints': 1332, 'liveStreaming': False, 'showingGraph': True, 'showingTable': True, 'adhocFilters': []}
  • This request['targets'] field should include: the driver cmd, arch, num_cu, solver(optional). This should be in a JSON format.
  • Flask would pick the best solver for this Driver cmd and only plot the best solver.
  • Grafana should be able to take in multiple driver commands, colon separated.
  • Flask will parse request['targets'] and use tuna code to get the information from the find_db table.
  • Flask will send back data in json format to plot.
  • Grafana will then display the results in graph format where X will represent the time unit(timestamp from find_db_history table and Y will represent the kernel time. NOTE: the dashboard also includes a table. The tooltip of each datapoint will include the Driver cmd and the solver
  1. Allow a user to query all the driver command lines associated with a particular tag
  • The Grafana dashboard should populate the unique tags in a field, from which the user can select a tag.
  • For the selected tag above, Grafana will prepare a CURL request to the flask app, which would query the database for all the configs with the specified tag
  • convert them to driver command lines and return the list.
  • The tag can follow the syntax of a LIKE string specification to allow for querying a group of tags at the same time. For example resnet% to query all resnets together