Skip to content

Commit 25d3d39

Browse files
Debug support (#62)
* perf: include debugging support * chore: update submodules * perf: align start script to others * chore: update submodules
1 parent c633c24 commit 25d3d39

File tree

5 files changed

+50
-5
lines changed

5 files changed

+50
-5
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
*.ipynb
22
.ipynb_checkpoints
33
.idea
4-
.vscode/
4+
.vscode/*
5+
!.vscode/launch.json
56

67
# Byte-compiled / optimized / DLL files
78
__pycache__/

.vscode/launch.json

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
// Use IntelliSense to learn about possible attributes.
3+
// Hover to view descriptions of existing attributes.
4+
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5+
"version": "0.2.0",
6+
"configurations": [
7+
{
8+
"name": "Python Debugger: refinery-weak-supervisor",
9+
"type": "debugpy",
10+
"request": "attach",
11+
"connect": {
12+
"host": "localhost",
13+
"port": 15677
14+
},
15+
"pathMappings": [
16+
{
17+
"localRoot": "${workspaceFolder}",
18+
"remoteRoot": "."
19+
}
20+
]
21+
}
22+
]
23+
}

requirements-dev.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
-r requirements.txt
22
httpx==0.25.0
3-
pytest==8.1.1
3+
pytest==8.1.1
4+
debugpy==1.8.12

start

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,20 @@
11
#!/bin/bash
2+
3+
DEBUG_MODE=false
4+
DEBUG_PORT=15677
5+
6+
while getopts d flag
7+
do
8+
case "${flag}" in
9+
d) DEBUG_MODE=true;;
10+
esac
11+
done
12+
13+
CMD=""
14+
if [ $DEBUG_MODE = true ]; then
15+
CMD="debugpy --wait-for-client --listen 0.0.0.0:$DEBUG_PORT -m uvicorn app:app --host 0.0.0.0 --port 80 --reload"
16+
fi
17+
218
trap "echo -ne '\nstopping container...' && docker stop refinery-weak-supervisor > /dev/null 2>&1 && echo -ne '\t\t [done]\n'" EXIT
319

420
echo -ne 'stopping old container...'
@@ -20,20 +36,24 @@ then
2036
fi
2137

2238
echo -ne 'building container...'
23-
docker build -t refinery-weak-supervisor-dev -f dev.Dockerfile . > /dev/null 2>&1
39+
docker build -t refinery-weak-supervisor-dev -f dev.Dockerfile .
2440
echo -ne '\t\t [done]\n'
2541

2642
echo -ne 'starting...'
2743
docker run -d --rm \
2844
--name refinery-weak-supervisor \
45+
-p $DEBUG_PORT:$DEBUG_PORT \
2946
-p 7054:80 \
3047
-e POSTGRES=postgresql://postgres:kern@graphql-postgres:5432 \
3148
-e WS_NOTIFY_ENDPOINT="http://refinery-websocket:8080" \
3249
--mount type=bind,source="$(pwd)"/,target=/app \
3350
-v /var/run/docker.sock:/var/run/docker.sock \
3451
-v "$INFERENCE_DIR":/inference \
3552
--network dev-setup_default \
36-
refinery-weak-supervisor-dev > /dev/null 2>&1
53+
refinery-weak-supervisor-dev $CMD > /dev/null 2>&1
3754
echo -ne '\t\t\t [done]\n'
3855

56+
if [ $DEBUG_MODE = true ]; then
57+
echo -e "\033[0;33muse VSCode Debugger (Python Debugger: refinery-weak-supervisor) to start the service\033[0m"
58+
fi
3959
docker logs -f refinery-weak-supervisor

0 commit comments

Comments
 (0)