Skip to content

Commit d255c0f

Browse files
committed
Merge branch 'main' into status-waiting-time
* main: Hotfix for check on frequency provider Tests run_until must be guard-claused with cleanup routine (#616) Fix check if stderr is empty (#613) Bump uvicorn[standard] from 0.24.0.post1 to 0.25.0 (#612) Fxing the network provider stderror Branch and filename are now always not null (#602) Adds a more elaborate depends_on test Support reading notes from services (#590) docker build command in tests now checks reason for docker build failure. If it is a permission issue with the cache, it will continue the rest of the workflow (#576) Use depends_on for container startup order (refactored) (#593) Bump psycopg[binary] from 3.1.15 to 3.1.16 (#610) Added powercap info to hardware_info (#609) Changed wording for network infrastructure box (#608) Added SIGQUIT to nginx and initi to gunicorn, as we are using bash script in entrypoint (#605) Fix frontend flow menu to wrap automatically (#584) Bump psutil from 5.9.6 to 5.9.7 (#603) Disable Docker CLI hints (#555) Create codeql.yml
2 parents d494f80 + ce28d47 commit d255c0f

29 files changed

+666
-91
lines changed

.github/actions/gmt-pytest/action.yml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,21 @@ runs:
6060
password: ${{ inputs.github-token }}
6161

6262
- name: Build docker-compose
63+
id: build-docker-compose
6364
shell: bash
6465
working-directory: ${{ inputs.gmt-directory }}/docker
65-
run: docker buildx bake --file test-compose.yml --file docker-compose-cache.json
66+
run: |
67+
{ DOCKER_OUTPUT=$(docker buildx bake --file test-compose.yml --file docker-compose-cache.json 2>&1); DOCKER_EXIT_CODE=$?; } || true
68+
if [ "$DOCKER_EXIT_CODE" -ne 0 ]; then
69+
echo "Docker build failed with exit code $DOCKER_EXIT_CODE"
70+
echo "buildx output:"
71+
echo $DOCKER_OUTPUT
72+
if echo "$DOCKER_OUTPUT" | grep -q "403 Forbidden"; then
73+
echo "Docker build failed due to permissions issue. Continuing..."
74+
else
75+
exit 1
76+
fi
77+
fi
6678
6779
- name: Start Test container
6880
shell: bash

.github/workflows/codeql.yml

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
# For most projects, this workflow file will not need changing; you simply need
2+
# to commit it to your repository.
3+
#
4+
# You may wish to alter this file to override the set of languages analyzed,
5+
# or to provide custom queries or build logic.
6+
#
7+
# ******** NOTE ********
8+
# We have attempted to detect the languages in your repository. Please check
9+
# the `language` matrix defined below to confirm you have the correct set of
10+
# supported CodeQL languages.
11+
#
12+
name: "CodeQL"
13+
14+
on:
15+
push:
16+
branches: [ "main" ]
17+
pull_request:
18+
branches: [ "main" ]
19+
20+
jobs:
21+
analyze:
22+
name: Analyze
23+
# Runner size impacts CodeQL analysis time. To learn more, please see:
24+
# - https://gh.io/recommended-hardware-resources-for-running-codeql
25+
# - https://gh.io/supported-runners-and-hardware-resources
26+
# - https://gh.io/using-larger-runners
27+
# Consider using larger runners for possible analysis time improvements.
28+
runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-latest' }}
29+
timeout-minutes: ${{ (matrix.language == 'swift' && 120) || 360 }}
30+
permissions:
31+
actions: read
32+
contents: read
33+
security-events: write
34+
35+
strategy:
36+
fail-fast: false
37+
matrix:
38+
language: [ 'javascript-typescript', 'python' ]
39+
# CodeQL supports [ 'c-cpp', 'csharp', 'go', 'java-kotlin', 'javascript-typescript', 'python', 'ruby', 'swift' ]
40+
# Use only 'java-kotlin' to analyze code written in Java, Kotlin or both
41+
# Use only 'javascript-typescript' to analyze code written in JavaScript, TypeScript or both
42+
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support
43+
44+
steps:
45+
- name: Checkout repository
46+
uses: actions/checkout@v4
47+
48+
# Initializes the CodeQL tools for scanning.
49+
- name: Initialize CodeQL
50+
uses: github/codeql-action/init@v3
51+
with:
52+
languages: ${{ matrix.language }}
53+
# If you wish to specify custom queries, you can do so here or in a config file.
54+
# By default, queries listed here will override any specified in a config file.
55+
# Prefix the list here with "+" to use these queries and those in the config file.
56+
57+
# For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
58+
queries: security-extended
59+
60+
61+
# Autobuild attempts to build any compiled languages (C/C++, C#, Go, Java, or Swift).
62+
# If this step fails, then you should remove it and run the build manually (see below)
63+
- name: Autobuild
64+
uses: github/codeql-action/autobuild@v3
65+
66+
# ℹ️ Command-line programs to run using the OS shell.
67+
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
68+
69+
# If the Autobuild fails above, remove it and uncomment the following three lines.
70+
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.
71+
72+
# - run: |
73+
# echo "Run, Build Application using script"
74+
# ./location_of_script_within_repo/buildscript.sh
75+
76+
- name: Perform CodeQL Analysis
77+
uses: github/codeql-action/analyze@v3
78+
with:
79+
category: "/language:${{matrix.language}}"

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,4 @@ tools/sgx_enable
1919
venv/
2020
lib/hardware_info_root.py
2121
tools/cluster/cleanup.sh
22+
node_modules/

api/api_helpers.py

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -108,17 +108,15 @@ def get_run_info(run_id):
108108
return DB().fetch_one(query, params=params, row_factory=psycopg_rows_dict_row)
109109

110110

111-
def get_timeline_query(uri,filename,machine_id, branch, metrics, phase, start_date=None, end_date=None, detail_name=None, limit_365=False, sorting='run'):
111+
def get_timeline_query(uri, filename, machine_id, branch, metrics, phase, start_date=None, end_date=None, detail_name=None, limit_365=False, sorting='run'):
112112

113113
if filename is None or filename.strip() == '':
114114
filename = 'usage_scenario.yml'
115115

116-
params = [uri, filename, machine_id, f"%{phase}"]
116+
if branch is None or branch.strip() != '':
117+
branch = 'main'
117118

118-
branch_condition = 'AND r.branch IS NULL'
119-
if branch is not None and branch.strip() != '':
120-
branch_condition = 'AND r.branch = %s'
121-
params.append(branch)
119+
params = [uri, filename, branch, machine_id, f"%{phase}"]
122120

123121
metrics_condition = ''
124122
if metrics is None or metrics.strip() == '' or metrics.strip() == 'key':
@@ -161,10 +159,10 @@ def get_timeline_query(uri,filename,machine_id, branch, metrics, phase, start_da
161159
WHERE
162160
r.uri = %s
163161
AND r.filename = %s
162+
AND r.branch = %s
164163
AND r.end_measurement IS NOT NULL
165164
AND r.machine_id = %s
166165
AND p.phase LIKE %s
167-
{branch_condition}
168166
{metrics_condition}
169167
{start_date_condition}
170168
{end_date_condition}
@@ -176,13 +174,14 @@ def get_timeline_query(uri,filename,machine_id, branch, metrics, phase, start_da
176174
p.phase ASC, {sorting_condition}
177175
178176
"""
177+
179178
return (query, params)
180179

181180
def determine_comparison_case(ids):
182181

183182
query = '''
184183
WITH uniques as (
185-
SELECT uri, filename, machine_id, commit_hash, COALESCE(branch, 'main / master') as branch FROM runs
184+
SELECT uri, filename, machine_id, commit_hash, branch FROM runs
186185
WHERE id = ANY(%s::uuid[])
187186
GROUP BY uri, filename, machine_id, commit_hash, branch
188187
)
@@ -282,7 +281,7 @@ def get_phase_stats(ids):
282281
query = """
283282
SELECT
284283
a.phase, a.metric, a.detail_name, a.value, a.type, a.max_value, a.min_value, a.unit,
285-
b.uri, c.description, b.filename, b.commit_hash, COALESCE(b.branch, 'main / master') as branch
284+
b.uri, c.description, b.filename, b.commit_hash, b.branch
286285
FROM phase_stats as a
287286
LEFT JOIN runs as b on b.id = a.run_id
288287
LEFT JOIN machines as c on c.id = b.machine_id

api/main.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ async def get_repositories(uri: str | None = None, branch: str | None = None, ma
227227
async def get_runs(uri: str | None = None, branch: str | None = None, machine_id: int | None = None, machine: str | None = None, filename: str | None = None, limit: int | None = None):
228228

229229
query = """
230-
SELECT r.id, r.name, r.uri, COALESCE(r.branch, 'main / master'), r.created_at, r.invalid_run, r.filename, m.description, r.commit_hash, r.end_measurement
230+
SELECT r.id, r.name, r.uri, r.branch, r.created_at, r.invalid_run, r.filename, m.description, r.commit_hash, r.end_measurement
231231
FROM runs as r
232232
LEFT JOIN machines as m on r.machine_id = m.id
233233
WHERE 1=1
@@ -303,7 +303,7 @@ async def compare_in_repo(ids: str):
303303
machine = machines[run_info['machine_id']]
304304
uri = run_info['uri']
305305
usage_scenario = run_info['usage_scenario']['name']
306-
branch = run_info['branch'] if run_info['branch'] is not None else 'main / master'
306+
branch = run_info['branch']
307307
commit = run_info['commit_hash']
308308
filename = run_info['filename']
309309

@@ -519,8 +519,8 @@ async def get_timeline_projects():
519519
FROM runs as r
520520
WHERE
521521
p.url = r.uri
522-
AND COALESCE(p.branch, 'main / master') = COALESCE(r.branch, 'main / master')
523-
AND COALESCE(p.filename, 'usage_scenario.yml') = COALESCE(r.filename, 'usage_scenario.yml')
522+
AND p.branch = r.branch
523+
AND p.filename = r.filename
524524
AND p.machine_id = r.machine_id
525525
ORDER BY r.created_at DESC
526526
LIMIT 1
@@ -1017,15 +1017,15 @@ async def software_add(software: Software):
10171017
if software.email is None or software.email.strip() == '':
10181018
raise RequestValidationError('E-mail is empty')
10191019

1020-
if not DB().fetch_one('SELECT id FROM machines WHERE id=%s AND available=TRUE', params=(software.machine_id,)):
1021-
raise RequestValidationError('Machine does not exist')
1020+
if software.branch is None or software.branch.strip() == '':
1021+
software.branch = 'main'
10221022

1023+
if software.filename is None or software.filename.strip() == '':
1024+
software.filename = 'usage_scenario.yml'
10231025

1024-
if software.branch.strip() == '':
1025-
software.branch = None
1026+
if not DB().fetch_one('SELECT id FROM machines WHERE id=%s AND available=TRUE', params=(software.machine_id,)):
1027+
raise RequestValidationError('Machine does not exist')
10261028

1027-
if software.filename.strip() == '':
1028-
software.filename = 'usage_scenario.yml'
10291029

10301030
if software.schedule_mode not in ['one-off', 'time', 'commit', 'variance']:
10311031
raise RequestValidationError(f"Please select a valid measurement interval. ({software.schedule_mode}) is unknown.")

config.yml.example

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ measurement:
4444
idle-time-end: 5
4545
flow-process-runtime: 3800
4646
phase-transition-time: 1
47+
boot:
48+
wait_time_dependencies: 20
4749
metric-providers:
4850

4951
# Please select the needed providers according to the working ones on your system

docker/compose.yml.example

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ services:
3232
# should not run on the measurement node anyway
3333
image: nginx
3434
container_name: green-coding-nginx-container
35+
stop_signal: SIGQUIT
3536
depends_on:
3637
- green-coding-postgres
3738
ports:
@@ -49,6 +50,7 @@ services:
4950
context: .
5051
dockerfile: Dockerfile-gunicorn
5152
container_name: green-coding-gunicorn-container
53+
init: true
5254
depends_on:
5355
- green-coding-postgres
5456
restart: always

docker/requirements.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
gunicorn==21.2.0
2-
psycopg[binary]==3.1.15
2+
psycopg[binary]==3.1.16
33
fastapi==0.105.0
4-
uvicorn[standard]==0.24.0.post1
4+
uvicorn[standard]==0.25.0
55
pandas==2.1.4
66
PyYAML==6.0.1
77
anybadge==1.14.0

docker/structure.sql

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ CREATE TABLE jobs (
2424
name text,
2525
email text,
2626
url text,
27-
branch text,
28-
filename text,
27+
branch text NOT NULL,
28+
filename text NOT NULL,
2929
categories int[],
3030
machine_id int REFERENCES machines(id) ON DELETE SET NULL ON UPDATE CASCADE,
3131
created_at timestamp with time zone DEFAULT now(),
@@ -41,13 +41,13 @@ CREATE TABLE runs (
4141
job_id integer REFERENCES jobs(id) ON DELETE SET NULL ON UPDATE CASCADE UNIQUE,
4242
name text,
4343
uri text,
44-
branch text,
44+
branch text NOT NULL,
4545
commit_hash text,
4646
commit_timestamp timestamp with time zone,
4747
email text,
4848
categories int[],
4949
usage_scenario json,
50-
filename text,
50+
filename text NOT NULL,
5151
machine_specs jsonb,
5252
runner_arguments json,
5353
machine_id int REFERENCES machines(id) ON DELETE SET NULL ON UPDATE CASCADE,
@@ -198,8 +198,8 @@ CREATE TABLE timeline_projects (
198198
name text,
199199
url text,
200200
categories integer[],
201-
branch text DEFAULT 'NULL'::text,
202-
filename text,
201+
branch text NOT NULL,
202+
filename text NOT NULL,
203203
machine_id integer REFERENCES machines(id) ON DELETE RESTRICT ON UPDATE CASCADE NOT NULL,
204204
schedule_mode text NOT NULL,
205205
last_scheduled timestamp with time zone,

frontend/compare.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ <h3>Single Phase Data</h3>
187187
Runtime can contain multiple flows.
188188
By default all runtime flows are aggregated. Please select a separate flow if needed.
189189
</div>
190-
<div id="runtime-sub-phases" class="ui top attached tabular menu">
190+
<div id="runtime-sub-phases" class="ui top attached tabular wrapping menu">
191191
<a class="active item" data-tab="[[RUNTIME]]">All Flows</a>
192192
<a class="item runtime-step" data-tab="" style="display:none;"></a> <!-- empty element for copying. Usage phases will be inserted before -->
193193
</div>

0 commit comments

Comments
 (0)