You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: backend/README.md
+52-42Lines changed: 52 additions & 42 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,20 @@
1
+
# Kubeflow Pipelines Backend
2
+
3
+
## Overview
4
+
1
5
This directory contains code for the components that comprise the Kubeflow
2
6
Pipelines backend.
3
7
8
+
This README will help you set up your coding environment in order to build and run the Kubeflow Pipelines backend. The KFP backend powers the core functionality of the KFP platform, handling API requests, workflow management, and data persistence.
- Docker or Podman installed (for building container images)
15
+
16
+
Note that you may need to restart your shell after installing these resources in order for the changes to take effect.
17
+
4
18
## Building & Testing
5
19
6
20
To run all unittests for backend:
@@ -15,64 +29,46 @@ The API server itself can be built using:
15
29
go build -o /tmp/apiserver backend/src/apiserver/*.go
16
30
```
17
31
18
-
## Code Style
19
-
20
-
Backend codebase follows the [Google's Go Style Guide](https://google.github.io/styleguide/go/). Please, take time to get familiar with the [best practices](https://google.github.io/styleguide/go/best-practices). It is not intended to be exhaustive, but it often helps minimizing guesswork among developers and keep codebase uniform and consistent.
21
-
22
-
We use [golangci-lint](https://golangci-lint.run/) tool that can catch common mistakes locally (see detailed configuration [here](https://github.com/kubeflow/pipelines/blob/master/.golangci.yaml)). It can be [conveniently integrated](https://golangci-lint.run/usage/integrations/) with multiple popular IDEs such as VS Code or Vim.
23
-
24
-
Finally, it is advised to install [pre-commit](https://pre-commit.com/) in order to automate linter checks (see configuration [here](https://github.com/kubeflow/pipelines/blob/master/.pre-commit-config.yaml))
25
-
26
-
## Building APIServer image locally
27
-
28
32
The API server image can be built from the root folder of the repo using:
You'll see the field reference the api server docker image.
45
+
You'll see the field reference the api server container image (`spec.containers[0].image: gcr.io/ml-pipeline/api-server:<image-version>`).
40
46
Change it to point to your own build, after saving and closing the file, apiserver will restart with your change.
41
47
42
-
## Building client library and swagger files
48
+
###Building client library and swagger files
43
49
44
50
After making changes to proto files, the Go client libraries, Python client libraries and swagger files
45
51
need to be regenerated and checked-in. Refer to [backend/api](./api/README.md) for details.
46
52
47
-
## Updating licenses info
48
-
49
-
1.[Install go-licenses tool](../hack/install-go-licenses.sh) and refer to [its documentation](https://github.com/google/go-licenses) for how to use it.
53
+
### Updating licenses info
50
54
55
+
1.[Install go-licenses tool](../hack/install-go-licenses.sh) (if you haven't already) and refer to [its documentation](https://github.com/google/go-licenses) for how to use it.
51
56
52
57
2. Run the tool to update all licenses:
53
58
54
59
```bash
55
-
make all
60
+
make -C backend all
56
61
```
57
62
58
-
## Updating python dependencies
59
-
60
-
[pip-tools](https://github.com/jazzband/pip-tools) is used to manage python
61
-
dependencies. To update dependencies, edit [requirements.in](requirements.in)
62
-
and run `./update_requirements.sh` to update and pin the transitive
63
-
dependencies.
64
-
65
-
# Visualization Server Instructions
66
-
67
-
## Updating python dependencies
63
+
### Updating python dependencies
68
64
69
65
[pip-tools](https://github.com/jazzband/pip-tools) is used to manage python
70
66
dependencies. To update dependencies, edit [requirements.in](requirements.in)
71
67
and run `./update_requirements.sh` to update and pin the transitive
### Run the KFP Backend Locally With a Kind Cluster
85
81
86
82
This deploys a local Kubernetes cluster leveraging [kind](https://kind.sigs.k8s.io/), with all the components required
87
83
to run the Kubeflow Pipelines API server. Note that the `ml-pipeline` `Deployment` (API server) has its replicas set to
@@ -99,6 +95,7 @@ pods on the cluster using the `ml-pipeline` `Service`.
99
95
network interface through Docker/Podman Desktop. See
100
96
[kind #1200](https://github.com/kubernetes-sigs/kind/issues/1200#issuecomment-1304855791) for an example manifest.
101
97
* Optional: VSCode is installed to leverage a sample `launch.json` file.
98
+
* This relies on dlv: (go install -v github.com/go-delve/delve/cmd/dlv@latest)
102
99
103
100
#### Provisioning the Cluster
104
101
@@ -111,15 +108,9 @@ make -C backend dev-kind-cluster
111
108
This may take several minutes since there are many pods. Note that many pods will be in "CrashLoopBackOff" status until
112
109
all the pods have started.
113
110
114
-
#### Deleting the Cluster
115
-
116
-
Run the following to delete the cluster:
111
+
Also, note that the config in the `make` command above sets the `ml-pipeline``Deployment` (api server) to have 0 replicas. The intent is to replace it with a locally running API server for debugging and faster development. See the following steps to run the API server locally, and connect it to the KFP backend on your Kind cluster. Note that other backend components (for example, the persistence agent) may show errors until the API server is brought up and connected to the cluster.
117
112
118
-
```bash
119
-
kind delete clusters dev-pipelines-api
120
-
```
121
-
122
-
#### Launch the API Server With VSCode
113
+
#### Launching the API Server With VSCode
123
114
124
115
After the cluster is provisioned, you may leverage the following sample `.vscode/launch.json` file to run the API
125
116
server locally:
@@ -168,12 +159,12 @@ You can also directly connect to the MariaDB database server with:
168
159
mysql -h 127.0.0.1 -u root
169
160
```
170
161
171
-
## Remote Debug the Driver
162
+
###Remote Debug the Driver
172
163
173
164
These instructions assume you are leveraging the Kind cluster in the
174
165
[Run Locally With a Kind Cluster](#run-locally-with-a-kind-cluster) section.
175
166
176
-
### Build the Driver Image With Debug Prerequisites
167
+
####Build the Driver Image With Debug Prerequisites
177
168
178
169
Run the following to create the `backend/Dockerfile.driver-debug` file and build the container image
179
170
tagged as `kfp-driver:debug`. This container image is based on `backend/Dockerfile.driver` but installs
@@ -197,7 +188,7 @@ Alternatively, you can use this Make target that does both.
197
188
make -C kind-build-and-load-driver-debug
198
189
```
199
190
200
-
### Run the API Server With Debug Configuration
191
+
####Run the API Server With Debug Configuration
201
192
202
193
You may use the following VS Code `launch.json` file to run the API server which overrides the Driver
203
194
command to use Delve and the Driver image to use debug image built previously.
@@ -229,7 +220,7 @@ command to use Delve and the Driver image to use debug image built previously.
229
220
}
230
221
```
231
222
232
-
### Starting a Remote Debug Session
223
+
####Starting a Remote Debug Session
233
224
234
225
Start by launching a pipeline. This will eventually create a Driver pod that is waiting for a remote debug connection.
235
226
@@ -273,3 +264,22 @@ For debugging a specific Driver pod, you'll need to continuously port forward an
273
264
without a breakpoint so that Delve will continue execution until the Driver pod you are interested in starts up. At that
274
265
point, you can set a break point, port forward, and connect to the remote debug session to debug that specific Driver
275
266
pod.
267
+
268
+
### Deleting the Kind Cluster
269
+
270
+
Run the following to delete the cluster (once you are finished):
271
+
272
+
```bash
273
+
kind delete clusters dev-pipelines-api
274
+
```
275
+
276
+
## Contributing
277
+
### Code Style
278
+
279
+
Backend codebase follows the [Google's Go Style Guide](https://google.github.io/styleguide/go/). Please, take time to get familiar with the [best practices](https://google.github.io/styleguide/go/best-practices). It is not intended to be exhaustive, but it often helps minimizing guesswork among developers and keep codebase uniform and consistent.
280
+
281
+
We use [golangci-lint](https://golangci-lint.run/) tool that can catch common mistakes locally (see detailed configuration [here](https://github.com/kubeflow/pipelines/blob/master/.golangci.yaml)). It can be [conveniently integrated](https://golangci-lint.run/usage/integrations/) with multiple popular IDEs such as VS Code or Vim.
282
+
283
+
Finally, it is advised to install [pre-commit](https://pre-commit.com/) in order to automate linter checks (see configuration [here](https://github.com/kubeflow/pipelines/blob/master/.pre-commit-config.yaml))
0 commit comments