Skip to content

Commit edd3231

Browse files
author
Sebastian Schmidl
authored
Adapt and build intermediate images (#22)
* refactor: split up base images and intermediate images; rename folders * feat: prepare image publishing and adapt docker images * feat: adapt intermediate images
1 parent 2b78aa2 commit edd3231

File tree

13 files changed

+204
-0
lines changed

13 files changed

+204
-0
lines changed

1-intermediate-images/pyod/Dockerfile

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
FROM ghcr.io/timeeval/python3-base:0.3.0
2+
3+
LABEL maintainer="[email protected]"
4+
5+
# install pyod library and cleanup afterwards
6+
RUN set -eux; \
7+
pip install --no-cache-dir pyod==0.9.2; \
8+
find /usr/local -depth \
9+
\( \
10+
\( -type d -a \( -name test -o -name tests -o -name idle_test \) \) \
11+
-o \
12+
\( -type f -a \( -name '*.pyc' -o -name '*.pyo' \) \) \
13+
\) -exec rm -rf '{}' +; \
14+
rm -rf /tmp/* /var/tmp/* ~/.cache/pip

1-intermediate-images/pyod/LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2020-2023 Phillip Wenig and Sebastian Schmidl
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
0.3.0
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
FROM ghcr.io/timeeval/python3-base:0.3.0
2+
3+
LABEL maintainer="[email protected]"
4+
5+
RUN pip install --no-cache-dir torch==1.7.1
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2020-2023 Phillip Wenig and Sebastian Schmidl
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
0.3.0
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
FROM ghcr.io/timeeval/python3-base:0.3.0
2+
3+
LABEL maintainer="[email protected]"
4+
5+
ENV ALGORITHM_MAIN=/app/algorithm.py
6+
7+
COPY manifest.json /app/
8+
COPY algorithm.py /app/
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2020-2023 Phillip Wenig and Sebastian Schmidl
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
import numpy as np
2+
import pandas as pd
3+
import json
4+
import time
5+
import argparse
6+
import sys
7+
8+
9+
class AlgorithmArgs(argparse.Namespace):
10+
@property
11+
def ts(self) -> np.ndarray:
12+
dataset = pd.read_csv(self.dataInput)
13+
return dataset.values[:, 1:-1]
14+
15+
@staticmethod
16+
def from_sys_args() -> 'AlgorithmArgs':
17+
args = json.loads(sys.argv[1])
18+
return AlgorithmArgs(**args)
19+
20+
21+
def main():
22+
args = AlgorithmArgs.from_sys_args()
23+
will_raise = args.customParameters.get("raise", False)
24+
sleep_seconds = args.customParameters.get("sleep", 10)
25+
write_preliminary_results = args.customParameters.get("write_prelim_results", False)
26+
27+
results = np.zeros(args.ts.shape[0])
28+
29+
if write_preliminary_results:
30+
results.tofile(args.dataOutput, sep="\n")
31+
32+
if will_raise:
33+
raise Exception("from within")
34+
35+
time.sleep(sleep_seconds)
36+
37+
results.tofile(args.dataOutput, sep="\n")
38+
39+
40+
if __name__ == "__main__":
41+
main()
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
{
2+
"title": "timeeval-test-algorithm",
3+
"description": "Test algorithm image for TimeEval.",
4+
"inputDimensionality": "multivariate",
5+
"version": "0.3.0",
6+
"authors": "Sebastian Schmidl, Phillip Wenig",
7+
"language": "Python",
8+
"type": "Detector",
9+
"mainFile": "algorithm.py",
10+
"learningType": "unsupervised",
11+
"executionStep": {
12+
"parameters": [
13+
{
14+
"name": "raise",
15+
"type": "bool",
16+
"defaultValue": false,
17+
"optional": "true",
18+
"description": "Force the algorithm to raise an exception and return a non-zero exit-code."
19+
},
20+
{
21+
"name": "sleep",
22+
"type": "int",
23+
"defaultValue": 10,
24+
"optional": "true",
25+
"description": "Controls the duration of the algorithm 'processing' via sleeping for a certain amount of time before writing the results."
26+
},
27+
{
28+
"name": "write_prelim_results",
29+
"type": "bool",
30+
"defaultValue": false,
31+
"optional": "true",
32+
"description": "If the algorithm should write some results before raising an exception or sleeping."
33+
}
34+
],
35+
"modelInput": "none"
36+
}
37+
}

0 commit comments

Comments
 (0)