-
-
Notifications
You must be signed in to change notification settings - Fork 134
161 lines (147 loc) · 5.96 KB
/
run_all_frameworks.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
name: Run All Frameworks
on: pull_request
jobs:
detect_changes: # Figure out which frameworks need to be evaluated based on which files are changed.
name: Detect Changes
runs-on: ubuntu-latest
outputs:
frameworks: ${{ steps.find-required-tests.outputs.frameworks }}
tasks: ${{ steps.find-required-tests.outputs.tasks }}
benchmark: ${{ steps.find-required-tests.outputs.benchmark }}
skip_baseline: ${{ steps.find-required-tests.outputs.skip_baseline }}
skip_evaluation: ${{ steps.find-required-tests.outputs.skip_evaluation }}
steps:
- uses: actions/checkout@v3
- name: pull base branch
run: |
git fetch --unshallow origin $GITHUB_BASE_REF
git branch --track $GITHUB_BASE_REF origin/$GITHUB_BASE_REF
- id: find-required-tests
name: Detect Common Changes # detect if any changes occurred that should trigger all frameworks.
run: |
changed_files=$(git diff --name-only $GITHUB_BASE_REF...HEAD)
shopt -s globstar
common_files="amlb/** "\
"resources/** "\
"frameworks/shared/** "\
".github/workflows/run_all_frameworks.yml "\
".github/runbenchmark/action.yml "\
"runbenchmark.py "\
"requirements.txt"
echo Common files: $common_files
echo Changed files: $changed_files
is_common=1
for f in $changed_files
do
if echo $common_files | grep -e $f >> /dev/null;
then
echo "File $f detected as common file"
is_common=0
break
fi
done
# Indicates which jobs should be executed (0) or not (1)
skip_evaluation=0
if [[ $is_common -eq 0 ]];
then
FRAMEWORKS='["autogluon", "autosklearn", "gama", "h2oautoml", "mlplanweka", "mlr3automl", "naiveautoml", "tpot", "tunedrandomforest"]'
TASKS='["iris", "kc2", "cholesterol"]'
BENCHMARK='["test"]'
else
TASKS='["APSFailure", "bioresponse", "dresses-sales", "eucalyptus", "internet-advertisements", "kc1", "micro-mass"]'
BENCHMARK='["validation"]'
changed_frameworks=$(git diff --name-only HEAD..$GITHUB_BASE_REF | grep -o -i -P 'frameworks/(?!shared).*/' | uniq | sed -e 's/frameworks//' -e 's/\///g')
if [ ! -z "$changed_frameworks" ];
then
json_array=[
for framework in $changed_frameworks; do json_array=$json_array\"$framework\",; done
FRAMEWORKS=${json_array::-1}] #remove trailing comma and add closing bracket
else
# No changes to common files or frameworks - must be e.g. docs. No need to run tests.
skip_evaluation=1
FRAMEWORKS=[]
fi
fi
echo Building matrix for frameworks: $FRAMEWORKS
echo "::set-output name=frameworks::$FRAMEWORKS"
echo "::set-output name=tasks::$TASKS"
echo "::set-output name=benchmark::$BENCHMARK"
echo "::set-output name=skip_baseline::$is_common"
echo "::set-output name=skip_evaluations::$skip_evaluation"
baseline:
name: ${{ matrix.framework }}/${{ matrix.task }}
runs-on: ubuntu-latest
needs: detect_changes
if: needs.detect_changes.outputs.skip_baseline == 0
strategy:
matrix:
framework: [constantpredictor, randomforest]
task: [iris, kc2, cholesterol]
fail-fast: false
steps:
- uses: actions/checkout@v3
- name: Setup Python 3.9
uses: actions/setup-python@v4
with:
python-version: '3.9'
- name: Create venv
run: python -m venv venv
- uses: actions/cache@v3
id: cache
with:
path: /home/runner/work/automlbenchmark/automlbenchmark/venv/lib/python3.9/site-packages
key: pip-v3-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
pip-v3-
- name: Install Requirements
if: steps.cache.outputs.cache-hit != 'true'
run: |
source venv/bin/activate
python -m pip install --upgrade pip
pip install -r requirements.txt
pip show openml
- name: Run constantpredictor on openml iris
run: |
source venv/bin/activate
python runbenchmark.py ${{ matrix.framework }} -t ${{ matrix.task }} -f 0 -e
run_frameworks:
name: ${{ matrix.framework }}/${{ matrix.task }}
runs-on: ubuntu-latest
needs:
- baseline
- detect_changes
if: ${{ success() }} || ${{ cancelled() }}
strategy:
matrix:
python-version: [3.9]
framework: ${{ fromJson(needs.detect_changes.outputs.frameworks) }}
task: ${{ fromJson(needs.detect_changes.outputs.tasks) }}
benchmark: ${{ fromJson(needs.detect_changes.outputs.benchmark) }}
fail-fast: true # not sure about this one, but considering the big workload it might be nicer
steps:
- uses: actions/checkout@v3
- name: Setup Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Create venv
run: python -m venv venv
- uses: actions/cache@v3
id: cache
with:
path: /home/runner/work/automlbenchmark/automlbenchmark/venv/lib/python3.9/site-packages
key: pip-v3-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
pip-v3-
- name: Install Requirements
if: steps.cache.outputs.cache-hit != 'true'
run: |
source venv/bin/activate
python -m pip install --upgrade pip
python -m pip install -r requirements.txt
- name: Run ${{ matrix.framework }} on ${{ matrix.task }}
run: |
source venv/bin/activate
python runbenchmark.py ${{ matrix.framework }} ${{ matrix.benchmark }} test -f 0 -t ${{ matrix.task }} -e
env:
GITHUB_PAT: ${{ secrets.PUBLIC_ACCESS_GITHUB_PAT }}