-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
261 additions
and
175 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
name: Execute algorithm and evaluate metrics | ||
|
||
on: | ||
push: | ||
branches: [ "main" ] | ||
paths: | ||
- 'algorithms/*.yaml' | ||
- '.github/workflows/algorithm-evaluation.yml' | ||
pull_request: | ||
branches: [ "main" ] | ||
paths: | ||
- 'algorithms/*.yaml' | ||
- '.github/workflows/algorithm-evaluation.yml' | ||
|
||
jobs: | ||
execute: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Find updated algorithm | ||
id: find-algorithm | ||
uses: tj-actions/changed-files@v44 | ||
with: | ||
files: algorithms/**.yaml | ||
|
||
- uses: actions/checkout@v4 | ||
|
||
- name: Execute algorithm container | ||
run: | | ||
# iterate over all datasets in S3 | ||
for recording in $(aws s3api list-objects --bucket ${AWS_BUCKET} --prefix datasets --output text --query 'Contents[].[Key]' | grep '.*edf'); do | ||
if [ ${{ steps.find-algorithm.outputs.any_changed }} == "false" ]; then | ||
break | ||
fi | ||
# save each recording (dataset slice) to a temp file | ||
aws s3 cp s3://${AWS_BUCKET}/${recording} ./data/tmp.edf | ||
# Run inference on recording for every updated algorithm | ||
for algo in ${{ steps.find-algorithm.outputs.all_changed_files }}; do | ||
IMAGE=$(grep '^image: ' $algo | sed 's/^image: \+//' | tr -d \'\") | ||
ALGO_NAME=$(echo "$IMAGE" | iconv -t ascii//TRANSLIT | sed -r s/[^a-zA-Z0-9]+/-/g | sed -r s/^-+\|-+$//g | tr A-Z a-z) | ||
mkdir -p ./predictions | ||
chmod -R 777 ./predictions/ | ||
echo "Running inference for $ALGO_NAME" | ||
docker run \ | ||
-e INPUT=tmp.edf \ | ||
-e OUTPUT=tmp.tsv \ | ||
-v ./predictions:/output:rw \ | ||
-v ./data:/data:ro \ | ||
"${IMAGE}" | ||
# Upload predictions to S3 | ||
subpath=${recording#*/} | ||
prediction=${subpath%_eeg.edf}_events.tsv | ||
aws s3 cp \ | ||
./predictions/tmp.tsv \ | ||
"s3://${AWS_BUCKET}/submissions/${ALGO_NAME}/${prediction}" | ||
rm ./data/tmp.edf ./predictions/tmp.tsv | ||
done | ||
done | ||
env: | ||
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY }} | ||
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_KEY }} | ||
AWS_DEFAULT_REGION: ${{ secrets.AWS_REGION }} | ||
AWS_BUCKET: ${{secrets.AWS_BUCKET }} | ||
|
||
evaluate: | ||
runs-on: ubuntu-latest | ||
needs: [execute] | ||
container: | ||
image: ghcr.io/${{ github.repository }}-evaluator:main | ||
credentials: | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.github_token }} | ||
|
||
steps: | ||
|
||
- name: Evaluate algorithm predictions | ||
run: python __main__.py |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
name: Build website | ||
on: | ||
workflow_run: | ||
workflows: ["Execute algorithm and evaluate metrics"] | ||
branches: [main] | ||
types: | ||
- completed | ||
|
||
workflow_dispatch: | ||
|
||
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages | ||
permissions: | ||
contents: read | ||
pages: write | ||
id-token: write | ||
|
||
jobs: | ||
download: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Download results | ||
run: | | ||
aws s3 cp \ | ||
s3://${AWS_BUCKET}/results/results.json \ | ||
website/data/sampleEval.json | ||
env: | ||
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY }} | ||
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_KEY }} | ||
AWS_DEFAULT_REGION: ${{ secrets.AWS_REGION }} | ||
AWS_BUCKET: ${{secrets.AWS_BUCKET }} | ||
|
||
- name: upload artifact | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: web-data | ||
path: website/data/ | ||
|
||
|
||
build: | ||
needs: download | ||
runs-on: ubuntu-latest | ||
container: | ||
image: ghcr.io/${{ github.repository }}-site-builder:main | ||
credentials: | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.github_token }} | ||
steps: | ||
|
||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: download artifact | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: web-data | ||
path: website/data/ | ||
|
||
- name: Build website | ||
run: python script.py | ||
|
||
|
||
deploy: | ||
needs: build | ||
environment: | ||
name: github-pages | ||
url: ${{ steps.deployment.outputs.page_url }} | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup Pages | ||
uses: actions/configure-pages@v5 | ||
|
||
- name: Upload artifact | ||
uses: actions/upload-pages-artifact@v3 | ||
with: | ||
path: 'website/public' | ||
|
||
- name: Deploy to GitHub Pages | ||
id: deployment | ||
uses: actions/deploy-pages@v4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
name: PR checks fon algorithm submission | ||
name: PR checks on algorithm submission | ||
|
||
on: | ||
pull_request: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.