Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reactivate dashboard CI #952

Merged
merged 50 commits into from
Nov 23, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
525dbb3
Revert "Remove dashboard CI"
notoraptor Jun 21, 2022
12c6837
ci: make sure to run orion backend in repository root
notoraptor Jun 21, 2022
b96b94b
Rename dashboarc CI tests workflow
notoraptor Jun 21, 2022
1e2b963
Re-implement API call function based on NodeJS `http` module.
notoraptor Jun 27, 2022
1f3d7ce
- [dashboard/ci] use rebased and updated branch origin/feature/benchm…
notoraptor Jun 28, 2022
59f8919
CI passed, trigger again
notoraptor Jun 28, 2022
87dc839
CI faile with internal server errors: https://github.com/Epistimio/or…
notoraptor Jun 28, 2022
d936a25
CI passed. Trigger again.
notoraptor Jun 28, 2022
1b68954
CI failed. Backend uses config YAML from current PR, so config must b…
notoraptor Jun 28, 2022
6cf464c
CI passed. Retry
notoraptor Jun 28, 2022
115c1c8
dashboard tests: factorize and increment testing waitFor() function c…
notoraptor Jun 29, 2022
db204dd
Increase timeout for axios and test duration.
notoraptor Jun 29, 2022
e8445aa
Try to get orion log from dashboard CI
notoraptor Jun 30, 2022
2d82e80
Relative path is not allowed for artifacts
notoraptor Jun 30, 2022
145ac93
Try to check if artifact folder is created
notoraptor Jun 30, 2022
4ce4946
Fix YAML syntax
notoraptor Jun 30, 2022
dec3bef
Correctly pass environment variables through steps
notoraptor Jun 30, 2022
4577f96
Try to locate orion-log
notoraptor Jun 30, 2022
1732d7b
Log correctly found. Simplify CI
notoraptor Jun 30, 2022
609247b
Try to set up artifact for each tested node version
notoraptor Jun 30, 2022
7be68d6
Try to save artifact even if tests fail
notoraptor Jun 30, 2022
5ebf3d9
Trigger
notoraptor Jul 1, 2022
97ccb08
Update timeout limits for better understanding of errors (avoid havin…
notoraptor Jul 5, 2022
808dff5
By default, Jest runs NodeJS tests in parallel, that may cause too ma…
notoraptor Jul 5, 2022
d1e7e0f
Re-increase timeouts
notoraptor Jul 5, 2022
e368ac3
Try to make even API calls run sequentially, to prevent many calls in…
notoraptor Jul 6, 2022
9749997
Rename artifact
notoraptor Jul 6, 2022
5bbf577
Set orion backend log level to `debug` (lowest level) for more debugg…
notoraptor Jul 12, 2022
7cb6aa2
[dashboard src]
notoraptor Sep 12, 2022
e6eb842
Reduce number of workers and threads
notoraptor Sep 13, 2022
d2f70b5
Increase number of workers
notoraptor Sep 13, 2022
33813a9
Increase workers to 4
notoraptor Sep 13, 2022
10ec682
Back to 2 workers
notoraptor Sep 13, 2022
69709c4
Make orion backend more verbose
notoraptor Sep 14, 2022
ff3b188
Try to check filesystem type
notoraptor Sep 16, 2022
78ca9ff
Get info about current directory
notoraptor Sep 16, 2022
38a21f9
Use only 1 worker
notoraptor Sep 17, 2022
e9d231a
Re-run
notoraptor Sep 18, 2022
6a2c14c
Re-run again
notoraptor Sep 19, 2022
8977204
Try to use MongoDB.
notoraptor Sep 19, 2022
6d67e87
Do not create user
notoraptor Sep 19, 2022
6cf9dcc
Reformat code
notoraptor Sep 19, 2022
894e3fb
Try to simplify mongodb config in Github CI
notoraptor Sep 20, 2022
ca4840c
Test display trial info in a dialog.
notoraptor Sep 25, 2022
0b9c2f4
Test pagination
notoraptor Sep 25, 2022
8521efa
Test (de)select columns
notoraptor Sep 25, 2022
7ba2cb4
Test sort columns
notoraptor Sep 25, 2022
c7bd970
Test drag-and-drop columns.
notoraptor Sep 25, 2022
e395cdc
Update dates for mongodb
notoraptor Sep 25, 2022
866c034
[dashboard/test/database page] check supplementary columns fore selec…
notoraptor Nov 14, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
81 changes: 81 additions & 0 deletions .github/workflows/dashboard-src.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
# Workflow to run unit tests from Github Actions.
# Inspired from: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions

name: dashboard-src

on:
push:
branches: [ master, develop ]
pull_request:
branches: [ master, develop ]
schedule:
- cron: '44 4 * * *'
release:
types: [published]
workflow_dispatch:

defaults:
run:
working-directory: dashboard/src

jobs:
test-dashboard-src:

runs-on: ubuntu-latest

strategy:
matrix:
node-version: [12.x, 14.x, 16.x]

steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
# Launch an orion server
- name: Launch Orion server
uses: actions/setup-python@v2
with:
python-version: 3.8
- run: python -m pip install git+https://github.com/notoraptor/orion.git@feature/benchmark_webapi_rebased#egg=orion[profet]
- name: info about current directory
run: df .
- name: check filesystem type using df
run: df -Th
- name: check filesystem type using fstab
run: cat /etc/fstab

- name: Setup MongoDB
uses: supercharge/[email protected]
with:
mongodb-version: 4.2
mongodb-db: orion_dashboard_test
- name: Populate MongoDB
run: |
cd ../../
python .github/workflows/orion/pickle_to_mongodb.py
cd dashboard/src/

- name: Start Orion backend
run: |
# Start Orion backend in repository root folder.
cd ../../
mkdir -p gunicorn_tmp_dir
orion -vv serve -c .github/workflows/orion/orion_config_mongodb.yaml 2> orion-backend-${{ matrix.node-version }}.log &
cd dashboard/src/
# install
- run: yarn
# check files formatting using Carbon's `ci-check` script
- run: yarn ci-check
# Run tests
# NB: Tests are running in parallel by default, this may cause backend to receive too many requests in small time
# Option --runInBand allows running tests sequentially: https://jestjs.io/docs/cli#--runinband
- run: yarn test --all --verbose --runInBand
# Upload orion backend log.
- name: Get Orion backend log
if: always()
uses: actions/upload-artifact@v3
with:
name: orion-backend-log-artifact-${{ matrix.node-version }}
path: orion-backend-${{ matrix.node-version }}.log
7 changes: 5 additions & 2 deletions .github/workflows/orion/orion_config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@ storage:

gunicorn:
bind: '127.0.0.1:8000'
workers: 4
threads: 2
workers: 1
threads: 1
timeout: 600
loglevel: 'debug'
worker_tmp_dir: gunicorn_tmp_dir

frontends_uri: ["http://localhost:3000", "http://127.0.0.1:3000"]
14 changes: 14 additions & 0 deletions .github/workflows/orion/orion_config_mongodb.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
storage:
database:
name: 'orion_dashboard_test'
type: 'mongodb'

gunicorn:
bind: '127.0.0.1:8000'
workers: 1
threads: 1
timeout: 600
loglevel: 'debug'
worker_tmp_dir: gunicorn_tmp_dir

frontends_uri: ["http://localhost:3000", "http://127.0.0.1:3000"]
27 changes: 27 additions & 0 deletions .github/workflows/orion/pickle_to_mongodb.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
from orion.core.io.database.mongodb import MongoDB
from orion.core.io.database.pickleddb import PickledDB
from orion.storage.base import setup_storage


def main():
storage = setup_storage(
{
"database": {
"host": ".github/workflows/orion/db_dashboard_full.pkl",
"type": "pickleddb",
}
}
)
pickle_db = storage._db
assert isinstance(pickle_db, PickledDB)
mongo_db = MongoDB(name="orion_dashboard_test")
with pickle_db.locked_database(write=False) as database:
for collection_name in database._db.keys():
print(f"[{collection_name}]")
data = database.read(collection_name)
mongo_db.write(collection_name, data)
print("Pickle to Mongo DB done.")


if __name__ == "__main__":
main()
13 changes: 9 additions & 4 deletions dashboard/src/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,10 @@
"devDependencies": {
"@commitlint/cli": "17.0.1",
"@commitlint/config-conventional": "7.6.0",
"@testing-library/dom": "^8.13.0",
"@testing-library/jest-dom": "^5.16.4",
"@testing-library/react": "^12.1.5",
"@testing-library/user-event": "^13.5.0",
"@testing-library/dom": "^8.17.1",
"@testing-library/jest-dom": "^5.16.5",
"@testing-library/react": "^13.4.0",
"@testing-library/user-event": "^14.4.3",
"jest-canvas-mock": "^2.4.0",
"lint-staged": "12.4.2",
"prettier": "1.19.1",
Expand Down Expand Up @@ -89,5 +89,10 @@
"singleQuote": true,
"trailingComma": "es5"
},
"jest": {
"transformIgnorePatterns": [
"/node_modules/(?!react-dnd|core-dnd|@react-dnd|dnd-core|react-dnd-html5-backend)"
]
},
"packageManager": "[email protected]"
}
47 changes: 24 additions & 23 deletions dashboard/src/src/__tests__/ExperimentNavBar.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,30 +75,31 @@ test('Check filter experiments with search field', async () => {
else expect(domElement).toBeNull();
}
};
const user = userEvent.setup();
render(<ExperimentNavBar />);
const searchField = await screen.findByPlaceholderText('Search experiment');
expect(searchField).toBeInTheDocument();
userEvent.type(searchField, 'random');
await waitFor(() => checkExpectations([0, 0, 0, 0, 1, 0, 0]), {
interval: 1000,
timeout: 120000,
});
userEvent.clear(searchField);
userEvent.type(searchField, 'rosenbrock');
await waitFor(() => checkExpectations([0, 0, 0, 0, 1, 1, 0]), {
interval: 1000,
timeout: 120000,
});
userEvent.clear(searchField);
userEvent.type(searchField, 'dim-cat');
await waitFor(() => checkExpectations([0, 1, 0, 1, 0, 0, 0]), {
interval: 1000,
timeout: 120000,
});
userEvent.clear(searchField);
userEvent.type(searchField, 'unknown experiment');
await waitFor(() => checkExpectations([0, 0, 0, 0, 0, 0, 0]), {
interval: 1000,
timeout: 120000,
});
await user.type(searchField, 'random');
await waitFor(
() => checkExpectations([0, 0, 0, 0, 1, 0, 0]),
global.CONFIG_WAIT_FOR_LONG
);
await user.clear(searchField);
await user.type(searchField, 'rosenbrock');
await waitFor(
() => checkExpectations([0, 0, 0, 0, 1, 1, 0]),
global.CONFIG_WAIT_FOR_LONG
);
await user.clear(searchField);
await user.type(searchField, 'dim-cat');
await waitFor(
() => checkExpectations([0, 1, 0, 1, 0, 0, 0]),
global.CONFIG_WAIT_FOR_LONG
);
await user.clear(searchField);
await user.type(searchField, 'unknown experiment');
await waitFor(
() => checkExpectations([0, 0, 0, 0, 0, 0, 0]),
global.CONFIG_WAIT_FOR_LONG
);
});
47 changes: 17 additions & 30 deletions dashboard/src/src/__tests__/VisualizationsPage.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,7 @@ test('Test if we switch to visualization page', async () => {
// Let time for ExperimentNavBar to load experiments
// to prevent warnings about async calls not terminated
expect(
await screen.findByText(
/2-dim-shape-exp/,
{},
{ interval: 1000, timeout: 120000 }
)
await screen.findByText(/2-dim-shape-exp/, {}, global.CONFIG_WAIT_FOR_LONG)
).toBeInTheDocument();

// Make sure we are on default (landing) page
Expand All @@ -58,7 +54,7 @@ test('Test if we can select and unselect experiments', async () => {
const experiment = await screen.findByText(
/2-dim-shape-exp/,
{},
{ interval: 1000, timeout: 120000 }
global.CONFIG_WAIT_FOR_LONG
);
expect(experiment).toBeInTheDocument();

Expand All @@ -73,14 +69,11 @@ test('Test if we can select and unselect experiments', async () => {

// Check if plots are loaded
// Wait enough (3 seconds) to let plots load
await waitFor(
() => {
expect(
screen.queryByText(/Regret for experiment '2-dim-shape-exp'/)
).toBeInTheDocument();
},
{ interval: 1000, timeout: 120000 }
);
await waitFor(() => {
expect(
screen.queryByText(/Regret for experiment '2-dim-shape-exp'/)
).toBeInTheDocument();
}, global.CONFIG_WAIT_FOR_LONG);
expect(
await screen.findByText(
/Parallel Coordinates PLot for experiment '2-dim-shape-exp'/i
Expand Down Expand Up @@ -108,14 +101,11 @@ test('Test if we can select and unselect experiments', async () => {

// re-select experiment and check if plots are loaded
fireEvent.click(experiment);
await waitFor(
() => {
expect(
screen.queryByText(/Regret for experiment '2-dim-shape-exp'/)
).toBeInTheDocument();
},
{ interval: 1000, timeout: 120000 }
);
await waitFor(() => {
expect(
screen.queryByText(/Regret for experiment '2-dim-shape-exp'/)
).toBeInTheDocument();
}, global.CONFIG_WAIT_FOR_LONG);
expect(
await screen.findByText(
/Parallel Coordinates PLot for experiment '2-dim-shape-exp'/i
Expand All @@ -129,14 +119,11 @@ test('Test if we can select and unselect experiments', async () => {
const anotherExperiment = await screen.findByText(/tpe-rosenbrock/);
expect(anotherExperiment).toBeInTheDocument();
fireEvent.click(anotherExperiment);
await waitFor(
() => {
expect(
screen.queryByText(/Regret for experiment 'tpe-rosenbrock'/)
).toBeInTheDocument();
},
{ interval: 1000, timeout: 120000 }
);
await waitFor(() => {
expect(
screen.queryByText(/Regret for experiment 'tpe-rosenbrock'/)
).toBeInTheDocument();
}, global.CONFIG_WAIT_FOR_LONG);
expect(
await screen.findByText(
/Parallel Coordinates PLot for experiment 'tpe-rosenbrock'/i
Expand Down
Loading