Skip to content

Commit cdddfae

Browse files
committed
Run blueapi in debug mode and run setup prior to attach
1 parent c41062f commit cdddfae

4 files changed

Lines changed: 115 additions & 12 deletions

File tree

‎.devcontainer/devcontainer.json‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@
2929
"charliermarsh.ruff",
3030
"ms-pyright.pyright",
3131
"ms-azuretools.vscode-docker",
32-
"ms-kubernetes-tools.vscode-kubernetes-tools"
32+
"ms-kubernetes-tools.vscode-kubernetes-tools",
33+
"rioj7.command-variable",
3334
]
3435
}
3536
},

‎.vscode/launch.json‎

Lines changed: 28 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -24,19 +24,22 @@
2424
"host": "0.0.0.0",
2525
"port": 5678,
2626
},
27+
"preLaunchTask": "kubectl port-forward",
28+
"postDebugTask": "pv-unmount",
29+
"subProcess": true,
2730
"pathMappings": [
2831
{
29-
"localRoot": "${input:mount_path}",
30-
"remoteRoot": "/workspaces_git"
32+
"localRoot": "${input:Mount Point}",
33+
"remoteRoot": "${input:PVC Name}"
3134
},
3235
{
33-
"localRoot": "./src/blueapi",
34-
"remoteRoot": "/venv/lib/python3.1*/site-packages/blueapi"
36+
"localRoot": "${workspaceFolder}/src/blueapi",
37+
"remoteRoot": "/venv/lib/python3.11/site-packages/blueapi"
3538
},
3639
{
37-
"localRoot": ".",
38-
"remoteRoot": "/blueapi"
39-
},
40+
"localRoot": "${workspaceFolder}",
41+
"remoteRoot": "/workspaces/blueapi"
42+
}
4043
]
4144
},
4245
{
@@ -86,10 +89,24 @@
8689
],
8790
"inputs": [
8891
{
89-
"id": "mount_path",
90-
"type": "promptString",
91-
"description": "Mounted location of PVC containing /workspace_git/",
92-
"default": ""
92+
"id": "PVC Name",
93+
"type": "command",
94+
"command": "extension.commandvariable.promptStringRemember",
95+
"args": {
96+
"key": "PVC Name",
97+
"description": "Name of the PVC to mount locally",
98+
"default": "scratch-1.0.0"
99+
}
100+
},
101+
{
102+
"id": "Mount Point",
103+
"type": "command",
104+
"command": "extension.commandvariable.promptStringRemember",
105+
"args": {
106+
"key": "Mount Point",
107+
"description": "Location to mount PVC locally, must exist as an empty directory",
108+
"default": "/scratch/mountPoint"
109+
}
93110
},
94111
{
95112
"id": "controller_args",

‎.vscode/tasks.json‎

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,79 @@
1111
"cwd": "${workspaceRoot}"
1212
},
1313
"problemMatcher": [],
14+
},
15+
{
16+
"type": "shell",
17+
"label": "kubectl pv-mounter",
18+
"command": "kubectl",
19+
"args": [
20+
"pv-mounter",
21+
"mount",
22+
"${input:namespace}",
23+
"${input:PVC Name}",
24+
"${input:Mount Point}",
25+
"--cpu-limit",
26+
"100m"
27+
],
28+
"problemMatcher": [],
29+
},
30+
{
31+
"dependsOn": "kubectl pv-mounter",
32+
"type": "shell",
33+
"label": "kubectl port-forward",
34+
"command": "kubectl",
35+
"args": [
36+
"port-forward",
37+
"-n",
38+
"${input:namespace}",
39+
"${input:pod}",
40+
"5678",
41+
"&"
42+
],
43+
"problemMatcher": [],
44+
},
45+
{
46+
"type": "shell",
47+
"label": "pv-unmount",
48+
"command": "kubectl",
49+
"args": [
50+
"pv-mounter",
51+
"clean",
52+
"${input:namespace}",
53+
"${promptStringRemember:PVC Name}",
54+
"${promptStringRemember:Mount Point}",
55+
],
56+
"problemMatcher": [],
1457
}
58+
],
59+
"inputs": [
60+
{
61+
"id": "namespace",
62+
"type": "promptString",
63+
"description": "Beamline namespace in the cluster",
64+
"default": "ixx-beamline"
65+
},
66+
{
67+
"id": "pod",
68+
"type": "promptString",
69+
"description": "Blueapi pod name",
70+
"default": "ixx-blueapi-0"
71+
},
72+
{
73+
"id": "PVC Name",
74+
"type": "command",
75+
"command": "extension.commandvariable.remember",
76+
"args": {
77+
"key": "PVC Name"
78+
}
79+
},
80+
{
81+
"id": "Mount Point",
82+
"type": "command",
83+
"command": "extension.commandvariable.remember",
84+
"args": {
85+
"key": "Mount Point"
86+
}
87+
},
1588
]
1689
}

‎helm/blueapi/templates/statefulset.yaml‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,18 @@ spec:
155155
name: nslcd
156156
{{- end }}
157157
{{- if not .Values.debug.enabled }}
158+
command: [
159+
"python",
160+
"-Xfrozen_modules=off",
161+
"-m",
162+
"debugpy",
163+
"--listen",
164+
"0.0.0.0:5678",
165+
"--configure-subProcess",
166+
"true",
167+
"-m",
168+
"blueapi"
169+
]
158170
args:
159171
- "-c"
160172
- "/config/config.yaml"

0 commit comments

Comments
 (0)