Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
* dev:
  Currently broken and unused functionality removed
  • Loading branch information
ArneTR committed Jan 30, 2023
2 parents bc76dfa + 3121cf2 commit 0ce28f6
Show file tree
Hide file tree
Showing 9 changed files with 2 additions and 814 deletions.
62 changes: 1 addition & 61 deletions api/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
from fastapi.middleware.cors import CORSMiddleware
from fastapi.responses import JSONResponse
from fastapi import Response
from fastapi import FastAPI, Request, Query
from fastapi import FastAPI, Request
from global_config import GlobalConfig
from db import DB
import jobs
Expand Down Expand Up @@ -212,66 +212,6 @@ async def get_stats_single(project_id: str, remove_idle: bool = False):
return {'success': True, 'data': data}


@app.get('/v1/stats/multi')
# pylint: disable=unsupported-binary-operation
# Here pylint does not understand the type hinting
async def get_stats_multi(pids: list[str] | None = Query(default=None)):
for pid in pids:
if pid is None or pid.strip() == '':
return {'success': False, 'err': 'Project_id is empty'}

query = """
SELECT
projects.id, projects.name, stats.detail_name, stats.time, stats.metric, stats.value, stats.unit
FROM
stats
LEFT JOIN
projects
ON
stats.project_id = projects.id
WHERE
stats.metric = ANY(ARRAY['cpu','mem','system-energy'])
AND
STATS.project_id = ANY(%s::uuid[])
"""
params = (pids,)
data = DB().fetch_all(query, params=params)

if data is None or data == []:
return {'success': False, 'err': 'Data is empty'}
return {'success': True, 'data': data}


@app.get('/v1/stats/compare')
# pylint: disable=unsupported-binary-operation
# Here pylint does not understand the type hinting
async def get_stats_compare(pids: list[str] | None = Query(default=None)):
for pid in pids:
if pid is None or pid.strip() == '':
return {'success': False, 'err': 'Project_id is empty'}

query = """
SELECT
projects.name, stats.detail_name, stats.metric, stats.unit, AVG(stats.value)
FROM
stats
LEFT JOIN
projects
ON
stats.project_id = projects.id
WHERE
stats.metric = ANY(ARRAY['cpu','mem','system-energy'])
AND
STATS.project_id = ANY(%s::uuid[])
GROUP BY projects.name, stats.detail_name, stats.metric
"""
params = (pids,)
data = DB().fetch_all(query, params=params)

if data is None or data == []:
return {'success': False, 'err': 'Data is empty'}
return {'success': True, 'data': data}

# A route to return all of the available entries in our catalog.
@app.get('/v1/badge/single/{project_id}')
async def get_badge_single(project_id: str, metric: str = 'ml-estimated'):
Expand Down
237 changes: 0 additions & 237 deletions frontend/compare-old.html

This file was deleted.

53 changes: 0 additions & 53 deletions frontend/compare.html

This file was deleted.

5 changes: 0 additions & 5 deletions frontend/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,6 @@ <h1 class="ui header float left">
<th>URI</th>
<th>Branch</th>
<th>Last run</th>
<th>
<button id="compare-button">
Compare
</button>
</th>
</tr>
</thead>
<tbody id="projects-table"></tbody>
Expand Down
Loading

0 comments on commit 0ce28f6

Please sign in to comment.