Skip to content

Commit 72c7ecd

Browse files
authored
Merge pull request #2 from bldrvnlw/master
pyhton-tsne now building and testing successfully
2 parents 5268042 + 8257316 commit 72c7ecd

36 files changed

+629
-75
lines changed

python-tsne/.bumpversion.cfg

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
[bumpversion]
2+
current_version = 0.3.1
3+
commit = True
4+
tag = True
5+
tag_name = python-tsne-{new_version}
6+
parse = (?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)
7+
serialize = {major}.{minor}.{patch}
8+
9+
[bumpversion:file:Dockerfile]
10+

python-tsne/Dockerfile

Lines changed: 28 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,35 @@
11
FROM hbpmip/python-mip:0.2.2
22

3+
4+
5+
ENV DOCKER_IMAGE=hbpmip/python-tsne:0.3.1 \
6+
FUNCTION=python-tsne
7+
38
# This COPY may be replaced by a build step when the atsne is open sourced (BvL 19/09/2017)
49
COPY atsne/ /atsne/
510
COPY requirements.txt /requirements.txt
6-
COPY tsne.py /main.py
11+
COPY tsne.py /tsne.py
12+
13+
RUN pip install -r /requirements.txt
14+
RUN apt-get update -y -qq && \
15+
apt-get install -y qt5-default && \
16+
apt-get install -y libgomp1 && \
17+
apt-get clean && \
18+
rm -rf /var/lib/apt/lists/*
719

8-
RUN conda install -y --file /requirements.txt
20+
# For dev purposes (i.e. docker exec) use the following noop daemon
21+
# ENTRYPOINT ["tail", "-f", "/dev/null"]
22+
ENTRYPOINT ["python", "/tsne.py"]
923

10-
ENV DOCKER_IMAGE=hbpmip/python-tsne
11-
ENV MODEL example
12-
ENV FUNCTION python-tsne
13-
ENV CODE tsne
14-
ENV NAME tsne
24+
LABEL org.label-schema.build-date=$BUILD_DATE \
25+
org.label-schema.name="hbpmip/python-tsne" \
26+
org.label-schema.description="Python wrapper for approximated tSNE" \
27+
org.label-schema.url="https://github.com/LREN-CHUV/algorithm-repository" \
28+
org.label-schema.vcs-type="git" \
29+
org.label-schema.vcs-url="https://github.com/LREN-CHUV/algorithm-repository.git" \
30+
org.label-schema.vcs-ref=$VCS_REF \
31+
org.label-schema.version="$VERSION" \
32+
org.label-schema.vendor="LKEB LUMC" \
33+
org.label-schema.license="AGPLv3" \
34+
org.label-schema.docker.dockerfile="Dockerfile" \
35+
org.label-schema.schema-version="1.0"

python-tsne/atsne/Dockerfile

Lines changed: 0 additions & 8 deletions
This file was deleted.

python-tsne/atsne/MNIST_1000.bin

-2.99 MB
Binary file not shown.

python-tsne/atsne/atsne_cmd

622 KB
Binary file not shown.

python-tsne/atsne/libGL.so.1

-613 KB
Binary file not shown.

python-tsne/atsne/libQt5Core.so.5

-5.26 MB
Binary file not shown.

python-tsne/atsne/libQt5Gui.so.5

-6.05 MB
Binary file not shown.

python-tsne/atsne/libQt5Widgets.so.5

-6.49 MB
Binary file not shown.

python-tsne/atsne/libX11-xcb.so.1

-5.85 KB
Binary file not shown.

python-tsne/atsne/libXdamage.so.1

-10 KB
Binary file not shown.

python-tsne/atsne/libXfixes.so.3

-22.1 KB
Binary file not shown.

python-tsne/atsne/libXxf86vm.so.1

-22.3 KB
Binary file not shown.

python-tsne/atsne/libdrm.so.2

-50.5 KB
Binary file not shown.

python-tsne/atsne/libflann_cpp.so.1.8

-5.77 KB
Binary file not shown.

python-tsne/atsne/libglapi.so.0

-162 KB
Binary file not shown.

python-tsne/atsne/libgomp.so.1

-87.6 KB
Binary file not shown.

python-tsne/atsne/libicudata.so.54

-24.2 MB
Binary file not shown.

python-tsne/atsne/libicui18n.so.54

-3.02 MB
Binary file not shown.

python-tsne/atsne/libicuuc.so.54

-1.92 MB
Binary file not shown.

python-tsne/atsne/libxcb-dri2.so.0

-18.1 KB
Binary file not shown.

python-tsne/atsne/libxcb-dri3.so.0

-10.1 KB
Binary file not shown.

python-tsne/atsne/libxcb-glx.so.0

-98.1 KB
Binary file not shown.

python-tsne/atsne/libxcb-present.so.0

-10.1 KB
Binary file not shown.

python-tsne/atsne/libxcb-sync.so.1

-26.2 KB
Binary file not shown.

python-tsne/atsne/libxshmfence.so.1

-5.83 KB
Binary file not shown.

python-tsne/build.sh

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,32 @@
11
#!/usr/bin/env bash
2-
if groups $USER | grep &>/dev/null '\bdocker\b'; then
2+
3+
set -o pipefail # trace ERR through pipes
4+
set -o errtrace # trace ERR through 'time command' and other functions
5+
set -o errexit ## set -e : exit the script if any statement returns a non-true return value
6+
7+
get_script_dir () {
8+
SOURCE="${BASH_SOURCE[0]}"
9+
10+
while [ -h "$SOURCE" ]; do
11+
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
12+
SOURCE="$( readlink "$SOURCE" )"
13+
[[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE"
14+
done
15+
cd -P "$( dirname "$SOURCE" )"
16+
pwd
17+
}
18+
19+
cd "$(get_script_dir)"
20+
21+
if [[ $NO_SUDO || -n "$CIRCLECI" ]]; then
22+
CAPTAIN="captain"
23+
elif groups $USER | grep &>/dev/null '\bdocker\b'; then
324
CAPTAIN="captain"
425
else
526
CAPTAIN="sudo captain"
627
fi
728

8-
$CAPTAIN build
29+
BUILD_DATE=$(date -Iseconds) \
30+
VCS_REF=$(git describe --tags --dirty) \
31+
VERSION=$(git describe --tags --dirty) \
32+
$CAPTAIN build

python-tsne/captain.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,5 @@ target_image:
55
- echo "Preparing python-tsne"
66
post:
77
- echo "Finished python-tsne"
8+
test:
9+
- ./tests/test.sh

python-tsne/dev.sh

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,13 @@
33
docker run \
44
-e "JOB_ID=$(uuidgen)" \
55
-e "NODE=federation" \
6-
-e "PARAM_variables=iq" \
7-
-e "PARAM_covariables=college_math,score_math_course1,score_math_course2" \
8-
-e "PARAM_grouping=" \
9-
-e "PARAM_meta={\"iq\":{\"code\":\"iq\",\"type\":\"real\"},\"college_math\":{\"code\":\"college_math\",\"type\":\"real\"},\"score_math_course1\":{\"code\":\"score_math_course1\",\"type\":\"real\"},\"score_math_course2\":{\"code\":\"score_math_course2\",\"type\":\"real\"}}" \
10-
-e "PARAM_query=select iq,college_math,score_math_course1,score_math_course2 from sample_data where iq is not null and college_math is not null and score_math_course1 is not null and score_math_course2 is not null" \
6+
-e "PARAM_variables=Name" \
7+
-e "PARAM_covariables=SepalLength,SepalWidth,PetalLength,PetalWidth" \
8+
-e "PARAM_query=select Name,SepalLength,SepalWidth,PetalLength,PetalWidth from sample_data where Name is not null and SepalLength is not null and SepalWidth is not null and PetalLength is not null and PetalWidth is not null" \
9+
-e "PARAM_meta={\"Name\":{\"code\":\"Name\",\"type\":\"string\"},\"SepalLength\":{\"code\":\"SepalLength\",\"type\":\"real\"},\"SepalWidth\":{\"code\":\"SepalWidth\",\"type\":\"real\"},\"PetalLength\":{\"code\":\"PetalLength\",\"type\":\"real\"}, \"PetalWidth\":{\"code\":\"PetalWidth\",\"type\":\"real\"}}" \
1110
-e "IN_JDBC_URL=jdbc:postgresql://172.18.0.1:5432/features" \
12-
-e "IN_JDBC_USER=postgres" \
13-
-e "IN_JDBC_PASSWORD=test" \
11+
-e "IN_JDBC_USER=features" \
12+
-e "IN_JDBC_PASSWORD=featurespwd" \
1413
-e "OUT_JDBC_URL=jdbc:postgresql://172.18.0.1:5432/woken" \
1514
-e "OUT_JDBC_USER=woken" \
1615
-e "OUT_JDBC_PASSWORD=wokenpwd" \

python-tsne/publish.sh

Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
#!/usr/bin/env bash
2+
3+
set -o pipefail # trace ERR through pipes
4+
set -o errtrace # trace ERR through 'time command' and other functions
5+
set -o errexit ## set -e : exit the script if any statement returns a non-true return value
6+
7+
get_script_dir () {
8+
SOURCE="${BASH_SOURCE[0]}"
9+
10+
while [ -h "$SOURCE" ]; do
11+
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
12+
SOURCE="$( readlink "$SOURCE" )"
13+
[[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE"
14+
done
15+
cd -P "$( dirname "$SOURCE" )"
16+
pwd
17+
}
18+
19+
WORKSPACE=$(get_script_dir)
20+
21+
if pgrep -lf sshuttle > /dev/null ; then
22+
echo "sshuttle detected. Please close this program as it messes with networking and prevents builds inside Docker to work"
23+
exit 1
24+
fi
25+
26+
if [ $NO_SUDO ]; then
27+
CAPTAIN="captain"
28+
elif groups $USER | grep &>/dev/null '\bdocker\b'; then
29+
CAPTAIN="captain"
30+
else
31+
CAPTAIN="sudo captain"
32+
fi
33+
34+
# Build
35+
echo "Build the project..."
36+
./build.sh
37+
./tests/test.sh
38+
echo "[ok] Done"
39+
40+
count=$(git status --porcelain | wc -l)
41+
if test $count -gt 0; then
42+
git status
43+
echo "Not all files have been committed in Git. Release aborted"
44+
exit 1
45+
fi
46+
47+
select_part() {
48+
local choice=$1
49+
case "$choice" in
50+
"Patch release")
51+
bumpversion patch
52+
;;
53+
"Minor release")
54+
bumpversion minor
55+
;;
56+
"Major release")
57+
bumpversion major
58+
;;
59+
*)
60+
read -p "Version > " version
61+
bumpversion --new-version=$version all
62+
;;
63+
esac
64+
}
65+
66+
git pull --tags
67+
# Look for a version tag in Git. If not found, ask the user to provide one
68+
[ $(git tag --points-at HEAD | grep python-tsne | wc -l) == 1 ] || (
69+
latest_version=$(bumpversion --dry-run --list patch | grep current_version | sed -r s,"^.*=",, || echo '0.0.1')
70+
echo
71+
echo "Current commit has not been tagged with a version. Latest known version is $latest_version."
72+
echo
73+
echo 'What do you want to release?'
74+
PS3='Select the version increment> '
75+
options=("Patch release" "Minor release" "Major release" "Release with a custom version")
76+
select choice in "${options[@]}";
77+
do
78+
select_part "$choice"
79+
break
80+
done
81+
updated_version=$(bumpversion --dry-run --list patch | grep current_version | sed -r s,"^.*=",,)
82+
read -p "Release version $updated_version? [y/N] > " ok
83+
if [ "$ok" != "y" ]; then
84+
echo "Release aborted"
85+
exit 1
86+
fi
87+
)
88+
89+
updated_version=$(bumpversion --dry-run --list patch | grep current_version | sed -r s,"^.*=",,)
90+
91+
# Build again to update the version
92+
echo "Build the project for distribution..."
93+
./build.sh
94+
./tests/test.sh
95+
echo "[ok] Done"
96+
97+
git push
98+
git push --tags
99+
100+
# Push on Docker Hub
101+
# WARNING: Requires captain 1.1.0 to push user tags
102+
BUILD_DATE=$(date -Iseconds) \
103+
VCS_REF=$updated_version \
104+
VERSION=$updated_version \
105+
WORKSPACE=$WORKSPACE \
106+
$CAPTAIN push target_image --branch-tags=false --commit-tags=false --tag $updated_version
107+
108+
# Notify on slack
109+
sed "s/USER/${USER^}/" $WORKSPACE/slack.json > $WORKSPACE/.slack.json
110+
sed -i.bak "s/VERSION/$updated_version/" $WORKSPACE/.slack.json
111+
curl -k -X POST --data-urlencode payload@$WORKSPACE/.slack.json https://hbps1.chuv.ch/slack/dev-activity
112+
rm -f $WORKSPACE/.slack.json $WORKSPACE/.slack.json.bak

python-tsne/requirements.txt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
pandas==0.20.3
2-
numpy=1.13.1
3-
scipy=0.19.1
2+
numpy==1.13.1
3+
scipy==0.19.1
4+
io_helper==0.2.2

python-tsne/test/docker-compose.yml

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
---
2+
3+
version: '2'
4+
services:
5+
6+
db:
7+
image: postgres:9.6.5-alpine
8+
hostname: db
9+
# Enable for foreground debugging
10+
ports:
11+
- "5432:5432"
12+
environment:
13+
POSTGRES_PASSWORD: test
14+
15+
wait_dbs:
16+
image: "waisbrot/wait"
17+
restart: "no"
18+
environment:
19+
TARGETS: "db:5432"
20+
TIMEOUT: 60
21+
22+
create_dbs:
23+
image: "hbpmip/create-databases:1.0.0"
24+
restart: "no"
25+
environment:
26+
DB_HOST: db
27+
DB_PORT: 5432
28+
DB_ADMIN_USER: postgres
29+
DB_ADMIN_PASSWORD: test
30+
DB1: features
31+
USER1: features
32+
PASSWORD1: featurespwd
33+
DB2: woken
34+
USER2: woken
35+
PASSWORD2: wokenpwd
36+
depends_on:
37+
- db
38+
39+
sample_data_db_setup:
40+
image: "hbpmip/sample-data-db-setup:latest"
41+
container_name: "data-db-setup"
42+
restart: "no"
43+
environment:
44+
FLYWAY_DBMS: postgresql
45+
FLYWAY_HOST: db
46+
FLYWAY_PORT: 5432
47+
FLYWAY_DATABASE_NAME: features
48+
FLYWAY_USER: postgres
49+
FLYWAY_PASSWORD: test
50+
depends_on:
51+
- db
52+
53+
woken_db_setup:
54+
image: "hbpmip/woken-db-setup:1.0.2"
55+
container_name: "woken-db-setup"
56+
restart: "no"
57+
environment:
58+
FLYWAY_DBMS: postgresql
59+
FLYWAY_HOST: db
60+
FLYWAY_PORT: 5432
61+
FLYWAY_DATABASE_NAME: woken
62+
FLYWAY_USER: postgres
63+
FLYWAY_PASSWORD: test
64+
depends_on:
65+
- db
66+
67+
tsne:
68+
image: "hbpmip/python-tsne:latest"
69+
container_name: "tsne"
70+
restart: "no"
71+
environment:
72+
FUNCTION: python-tsne
73+
NODE: job_test
74+
JOB_ID: 2
75+
IN_JDBC_DRIVER: org.postgresql.Driver
76+
IN_JDBC_URL: jdbc:postgresql://db:5432/features
77+
IN_JDBC_USER: features
78+
IN_JDBC_PASSWORD: featurespwd
79+
OUT_JDBC_DRIVER: org.postgresql.Driver
80+
OUT_JDBC_URL: jdbc:postgresql://db:5432/woken
81+
OUT_JDBC_USER: woken
82+
OUT_JDBC_PASSWORD: wokenpwd
83+
PARAM_variables: "name"
84+
PARAM_covariables: "sepal_length,sepal_width,petal_length,petal_width"
85+
PARAM_grouping: ""
86+
PARAM_query: "SELECT name,sepal_length,sepal_width,petal_length,petal_width FROM iris"
87+
PARAM_meta: "{\"name\":{\"code\":\"name\",\"type\":\"string\"},\"sepal_length\":{\"code\":\"sepal_length\",\"type\":\"real\"},\"sepal_width\":{\"code\":\"sepal_width\",\"type\":\"real\"},\"petal_length\":{\"code\":\"petal_length\",\"type\":\"real\"}, \"petal_width\":{\"code\":\"petal_width\",\"type\":\"real\"}}"
88+
PARAM_MODEL_dependent_is_label: "True"
89+
PARAM_MODEL_perplexity: 30
90+
PARAM_MODEL_do_zscore: "True"
91+
PARAM_MODEL_iterations: 1000
92+
PARAM_MODEL_theta: 0.5
93+
PARAM_MODEL_target_dimensions: 2
94+
links:
95+
- "db:db"

0 commit comments

Comments
 (0)