Skip to content

Commit c001880

Browse files
mhmdk0hasan7n
andauthored
Merge Tutorial Branch Into Main (#665)
* Refactor Web-UI Events, Tasks and Notifications (#660) * refactor web-ui tasks, events, notifications - use EventStream for sending events * Bug Fixes - SSE behavior, login. * modify security token flow to support URL-based login * resolve 'open button' confusion * resolve OPERATION -> OPERATIONAL in all entities * make valid/invalid all caps * remove is valid: (true/false) from dataset details and export dataset. modify export dataset ui * fix Registering Model -> Registering Container * remove the approved flag in benchmark details * remove report file field if it does not exist - temp (bug exists) * remove hashes from entities details * remove the additional N/A text - add "Owner" before owner ID * add navbar color (green) and add footer * fix footer - stick at the bottom * allow users to select containers based on their types instead of writing the IDs - benchmark registration * change name, description, and location maxlength - apply migrations * apply ui changes - footer and navbar * modify reload time into 1 second - medperf login and logout * auto approve benchmark for tutorial * autopopulate some mock benchmarks for tutorials * fix line length problem * fix association dropdown ui * fix hidden error - RuntimeError: Event object at ... is bound to a different event loop * fix print logs delays * add codespaces scripts --------- Co-authored-by: hasan7n <[email protected]> * pin click version * fix codespaces script * clear notifications after logging out * remove generated_uid from dataset details page * move print_webui_props to utils * WebUI E2E Tests (#664) * Add html attributes required for tests * fix missing function in common.js * fix compatibility/workflow tests popup modal title * fix auto-scroll lag issue * Add E2E tests for webui * ci: add GitHub workflow for WebUI E2E tests * fix tests issues * fix webui-ci * fix typo in local-auth env that caused errors while seeding db * remove auto-login when getting tutorial files - add profile activation test * remove logout button duplicate, add comment --------- Co-authored-by: hasan7n <[email protected]> * add EventsManager class to manage events/buffering. add 'webui' prefix for maxlogmessages, add other webui configs * remove the name validator from entities * remove chrome-setup from auth-ci --------- Co-authored-by: hasan7n <[email protected]>
1 parent 6f06808 commit c001880

File tree

105 files changed

+3052
-646
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

105 files changed

+3052
-646
lines changed
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"image": "docker.io/mlcommons/medperf-codespaces:latest",
3+
"features": {
4+
"ghcr.io/devcontainers/features/docker-in-docker:2": {
5+
"moby": false
6+
}
7+
},
8+
"postStartCommand": "bash /workspaces/medperf/tutorials_scripts/codespaces/webui/env_start.sh",
9+
"postAttachCommand": "bash /workspaces/medperf/tutorials_scripts/codespaces/webui/run_server_detached.sh"
10+
}

.github/workflows/auth-ci.yml

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,6 @@ jobs:
2525
uses: actions/setup-python@v2
2626
with:
2727
python-version: '3.9'
28-
29-
- name: Setup Chrome
30-
run: |
31-
sudo apt-get install -y wget
32-
wget -O chrome.deb https://dl.google.com/linux/chrome/deb/pool/main/g/google-chrome-stable/google-chrome-stable_126.0.6478.126-1_amd64.deb
33-
sudo apt update && sudo apt install ./chrome.deb -y --allow-downgrades
34-
rm chrome.deb
3528

3629
- name: Install dependencies
3730
working-directory: .

.github/workflows/unittests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ jobs:
3636
# Ignore E231, as it is raising warnings with auto-generated code.
3737
flake8 . --count --max-complexity=10 --max-line-length=127 --ignore F821,W503,E231 --statistics --exclude=examples/,"*/migrations/*",cli/medperf/templates/
3838
- name: Test with pytest
39-
working-directory: ./cli
39+
working-directory: ./cli/medperf/tests
4040
run: |
4141
pytest
4242
- name: Set server environment vars

.github/workflows/webui-ci.yml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: WebUI Integration workflow
2+
3+
on: pull_request
4+
5+
jobs:
6+
setup:
7+
name: webui-integration-test
8+
runs-on: ubuntu-latest
9+
steps:
10+
- name: Checkout repository
11+
uses: actions/checkout@v2
12+
13+
- name: Set up Python 3.9
14+
uses: actions/setup-python@v2
15+
with:
16+
python-version: '3.9'
17+
18+
- name: Install dependencies
19+
working-directory: .
20+
run: |
21+
python -m pip install --upgrade pip
22+
pip install -e cli/
23+
pip install -r cli/test-requirements.txt
24+
pip install -r server/requirements.txt
25+
pip install -r server/test-requirements.txt
26+
27+
- name: Set server environment vars
28+
working-directory: ./server
29+
run: cp .env.local.local-auth .env
30+
31+
- name: Run postgresql server in background
32+
working-directory: ./server
33+
run: sh run_dev_postgresql.sh && sleep 6
34+
35+
- name: Run django server in background with generated certs
36+
working-directory: ./server
37+
run: sh setup-dev-server.sh & sleep 6
38+
39+
- name: Reset and seed database with tutorial data
40+
working-directory: ./server
41+
run: sh reset_db.sh && python seed.py --demo tutorial
42+
43+
- name: Set up tutorial files
44+
working-directory: .
45+
run: bash tutorials_scripts/setup_webui_tutorial.sh
46+
47+
- name: Run fastapi server in background
48+
working-directory: .
49+
run: medperf_webui & sleep 6
50+
51+
- name: Run webUI tutorial E2E tests with pytest
52+
working-directory: ./cli/medperf/web_ui/tests/e2e/
53+
run: pytest

cli/cli_tests.sh

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -173,15 +173,6 @@ print_eval medperf benchmark submit --name bmk --description bmk --demo-url $DEM
173173
checkFailed "Benchmark submission failed"
174174
BMK_UID=$(medperf benchmark ls | grep bmk | tail -n 1 | tr -s ' ' | cut -d ' ' -f 2)
175175
echo "BMK_UID=$BMK_UID"
176-
177-
# Approve benchmark
178-
echo $ADMIN
179-
echo $MOCK_TOKENS_FILE
180-
ADMIN_TOKEN=$(jq -r --arg ADMIN $ADMIN '.[$ADMIN]' $MOCK_TOKENS_FILE)
181-
echo $ADMIN_TOKEN
182-
checkFailed "Retrieving admin token failed"
183-
print_eval "curl -sk -X PUT $SERVER_URL$VERSION_PREFIX/benchmarks/$BMK_UID/ -d '{\"approval_status\": \"APPROVED\"}' -H 'Content-Type: application/json' -H 'Authorization: Bearer $ADMIN_TOKEN' --fail-with-body"
184-
checkFailed "Benchmark approval failed"
185176
##########################################################
186177

187178
echo "\n"

cli/medperf/config.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,13 @@
232232
ui = "CLI"
233233
webui = "WEBUI"
234234

235+
# WebUI-related config
236+
webui_max_log_messages = 200 # Max nb of messages that will appear in LogPanel in WebUI
237+
webui_max_chunk_age = 2.0 # Max 2 seconds as age of a chunk
238+
webui_max_chunk_length = 20 # Max 20 events in a chunk
239+
webui_max_chunk_size = 64 * 1024 # Max 64 Bytes as chunk size
240+
241+
235242
default_profile_name = "default"
236243
testauth_profile_name = "testauth"
237244
test_profile_name = "local"

cli/medperf/entities/benchmark.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class Benchmark(Entity, ApprovableSchema, DeployableSchema):
2222
what models to run and how to evaluate them.
2323
"""
2424

25-
description: Optional[str] = Field(None, max_length=20)
25+
description: Optional[str] = Field(None, max_length=256)
2626
docs_url: Optional[HttpUrl]
2727
demo_dataset_tarball_url: str
2828
demo_dataset_tarball_hash: Optional[str]

cli/medperf/entities/dataset.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ class Dataset(Entity, DeployableSchema):
2222
data preparation output.
2323
"""
2424

25-
description: Optional[str] = Field(None, max_length=20)
26-
location: Optional[str] = Field(None, max_length=20)
25+
description: Optional[str] = Field(None, max_length=256)
26+
location: Optional[str] = Field(None, max_length=128)
2727
input_data_hash: str
2828
generated_uid: str
2929
data_preparation_mlcube: Union[int, str]

cli/medperf/entities/schemas.py

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
class MedperfSchema(BaseModel):
1212
for_test: bool = False
1313
id: Optional[int]
14-
name: str = Field(..., max_length=64)
14+
name: str = Field(..., max_length=128)
1515
owner: Optional[int]
1616
is_valid: bool = True
1717
created_at: Optional[datetime]
@@ -76,12 +76,6 @@ def empty_str_to_none(cls, v):
7676
return None
7777
return v
7878

79-
@validator("name", pre=True, always=True)
80-
def name_max_length(cls, v, *, values, **kwargs):
81-
if not values["for_test"] and len(v) > 20:
82-
raise ValueError("The name must have no more than 20 characters")
83-
return v
84-
8579
class Config:
8680
allow_population_by_field_name = True
8781
extra = "allow"

cli/medperf/entities/training_exp.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class TrainingExp(Entity, MedperfSchema, ApprovableSchema, DeployableSchema):
2121
what models to run and how to evaluate them.
2222
"""
2323

24-
description: Optional[str] = Field(None, max_length=20)
24+
description: Optional[str] = Field(None, max_length=256)
2525
docs_url: Optional[HttpUrl]
2626
demo_dataset_tarball_url: str
2727
demo_dataset_tarball_hash: Optional[str]

0 commit comments

Comments
 (0)