Skip to content

Commit ddf8b5f

Browse files
committed
Merge branch 'main' of github.com:flyteorg/flyte into docs/devbox-local-setup
Signed-off-by: Kevin Su <pingsutw@apache.org> # Conflicts: # CONTRIBUTING.md # README.md # dataproxy/service/dataproxy_service.go # dataproxy/service/dataproxy_service_test.go # docker/devbox-bundled/kustomize/complete/kustomization.yaml # docker/devbox-bundled/kustomize/dev/kustomization.yaml # docker/devbox-bundled/manifests/complete.yaml # docker/devbox-bundled/manifests/dev.yaml # manager/README.md # manager/config.yaml # runs/config.yaml # runs/repository/impl/sorting.go # runs/service/run_service.go # runs/service/run_service_test.go # runs/setup.go # runs/test/api/setup_test.go
2 parents 65498e7 + 38fb221 commit ddf8b5f

19 files changed

Lines changed: 1753 additions & 226 deletions

File tree

.github/dco.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
require:
2+
members: false
3+
allowRemediationCommits:
4+
individual: true
5+
thirdParty: true

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ uv pip install flyte[tui]
135135

136136
## Open Source Backend
137137

138-
The open source backend for Flyte 2 is **coming soon**. This repository will contain the Kubernetes-native backend infrastructure for deploying Flyte 2 as a distributed, multi-node service. See the [Backend README](BACKEND_README.md) for the current state of the backend, protocol buffer definitions, and contribution guide.
138+
The open source backend for Flyte 2 is **coming soon**. This repository will contain the Kubernetes-native backend infrastructure for deploying Flyte 2 as a distributed, multi-node service. See the [Backend README](docs/BACKEND_README.md) for the current state of the backend, protocol buffer definitions, and contribution guide.
139139

140140
If you need an enterprise-ready, production-grade backend for Flyte 2 today, it is available on [Union.ai](https://www.union.ai/try-flyte-2).
141141

@@ -151,7 +151,7 @@ If you need an enterprise-ready, production-grade backend for Flyte 2 today, it
151151

152152
## Contributing
153153

154-
We welcome contributions! See the [Backend README](BACKEND_README.md) for backend development, or join us on [slack.flyte.org](https://slack.flyte.org).
154+
We welcome contributions! See the [Backend README](docs/BACKEND_README.md) for backend development, or join us on [slack.flyte.org](https://slack.flyte.org).
155155

156156
## License
157157

dataproxy/service/dataproxy_service.go

Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,11 @@ import (
1919
"google.golang.org/protobuf/types/known/timestamppb"
2020

2121
"github.com/flyteorg/flyte/v2/dataproxy/config"
22+
"github.com/flyteorg/flyte/v2/dataproxy/logs"
2223
"github.com/flyteorg/flyte/v2/flytestdlib/logger"
2324
"github.com/flyteorg/flyte/v2/flytestdlib/storage"
2425
"github.com/flyteorg/flyte/v2/gen/go/flyteidl2/common"
2526
flyteIdlCore "github.com/flyteorg/flyte/v2/gen/go/flyteidl2/core"
26-
"github.com/flyteorg/flyte/v2/dataproxy/logs"
2727
"github.com/flyteorg/flyte/v2/gen/go/flyteidl2/dataproxy"
2828
"github.com/flyteorg/flyte/v2/gen/go/flyteidl2/dataproxy/dataproxyconnect"
2929
"github.com/flyteorg/flyte/v2/gen/go/flyteidl2/project"
@@ -470,6 +470,10 @@ func (s *Service) GetActionData(
470470
ctx context.Context,
471471
req *connect.Request[dataproxy.GetActionDataRequest],
472472
) (*connect.Response[dataproxy.GetActionDataResponse], error) {
473+
if err := req.Msg.Validate(); err != nil {
474+
return nil, connect.NewError(connect.CodeInvalidArgument, err)
475+
}
476+
473477
actionId := req.Msg.GetActionId()
474478

475479
urisResp, err := s.runClient.GetActionDataURIs(ctx, connect.NewRequest(&workflow.GetActionDataURIsRequest{
@@ -495,11 +499,17 @@ func (s *Service) GetActionData(
495499
}
496500
logger.Infof(groupCtx, "GetActionData: reading inputs from %s", inputRef)
497501
if err := s.dataStore.ReadProtobuf(groupCtx, inputRef, resp.Inputs); err != nil {
498-
logger.Errorf(groupCtx, "GetActionData: failed to read inputs from %s: %v", inputRef, err)
499-
return connect.NewError(connect.CodeInternal, fmt.Errorf("failed to read inputs from %s: %w", inputRef, err))
502+
if !storage.IsNotFound(err) {
503+
logger.Errorf(groupCtx, "GetActionData: failed to read inputs from %s: %v", inputRef, err)
504+
return connect.NewError(connect.CodeInternal, fmt.Errorf("failed to read inputs from %s: %w", inputRef, err))
505+
}
506+
} else {
507+
logger.Debugf(groupCtx, "Read %d input literals and %d action contexts", len(resp.Inputs.Literals), len(resp.Inputs.Context))
500508
}
501509
return nil
502510
})
511+
} else {
512+
logger.Warnf(ctx, "Action %s has empty InputURI", req.Msg.ActionId.Name)
503513
}
504514

505515
if urisResp.Msg.GetOutputsUri() != "" {
@@ -508,11 +518,16 @@ func (s *Service) GetActionData(
508518
logger.Infof(groupCtx, "GetActionData: reading outputs from %s", outputRef)
509519
var inputsOrOutputs task.Inputs
510520
if err := s.dataStore.ReadProtobuf(groupCtx, outputRef, &inputsOrOutputs); err != nil {
511-
logger.Errorf(groupCtx, "GetActionData: failed to read outputs from %s: %v", outputRef, err)
512-
return connect.NewError(connect.CodeInternal, fmt.Errorf("failed to read outputs from %s: %w", outputRef, err))
513-
}
514-
resp.Outputs = &task.Outputs{
515-
Literals: inputsOrOutputs.GetLiterals(),
521+
if !storage.IsNotFound(err) {
522+
logger.Errorf(groupCtx, "GetActionData: failed to read outputs from %s: %v", outputRef, err)
523+
return connect.NewError(connect.CodeInternal, fmt.Errorf("failed to read outputs from %s: %w", outputRef, err))
524+
}
525+
logger.Debugf(groupCtx, "Outputs not found at %s (action may not have finished)", urisResp.Msg.GetOutputsUri())
526+
} else {
527+
resp.Outputs = &task.Outputs{
528+
Literals: inputsOrOutputs.GetLiterals(),
529+
}
530+
logger.Debugf(groupCtx, "Read %d output literals", len(resp.Outputs.Literals))
516531
}
517532
return nil
518533
})

dataproxy/service/dataproxy_service_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@ import (
2626
"github.com/flyteorg/flyte/v2/gen/go/flyteidl2/dataproxy"
2727
"github.com/flyteorg/flyte/v2/gen/go/flyteidl2/dataproxy/dataproxyconnect"
2828
"github.com/flyteorg/flyte/v2/gen/go/flyteidl2/project"
29+
projectMocks "github.com/flyteorg/flyte/v2/gen/go/flyteidl2/project/projectconnect/mocks"
2930
"github.com/flyteorg/flyte/v2/gen/go/flyteidl2/task"
3031
"github.com/flyteorg/flyte/v2/gen/go/flyteidl2/workflow"
31-
projectMocks "github.com/flyteorg/flyte/v2/gen/go/flyteidl2/project/projectconnect/mocks"
3232
workflowMocks "github.com/flyteorg/flyte/v2/gen/go/flyteidl2/workflow/workflowconnect/mocks"
3333
)
3434

docker/devbox-bundled/kustomize/complete/kustomization.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,15 @@ patches:
4747
namespace: knative-serving
4848
data:
4949
"localhost": ""
50+
- patch: |-
51+
apiVersion: v1
52+
kind: ConfigMap
53+
metadata:
54+
name: config-deployment
55+
namespace: knative-serving
56+
data:
57+
registries-skipping-tag-resolving: "localhost:30000,kind-registry:5000"
58+
allow-http-registry: "true"
5059
- patch: |-
5160
apiVersion: rbac.authorization.k8s.io/v1
5261
kind: ClusterRole

docker/devbox-bundled/kustomize/dev/kustomization.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,15 @@ patches:
3737
namespace: knative-serving
3838
data:
3939
"localhost": ""
40+
- patch: |-
41+
apiVersion: v1
42+
kind: ConfigMap
43+
metadata:
44+
name: config-deployment
45+
namespace: knative-serving
46+
data:
47+
registries-skipping-tag-resolving: "localhost:30000,kind-registry:5000"
48+
allow-http-registry: "true"
4049
- patch: |-
4150
apiVersion: rbac.authorization.k8s.io/v1
4251
kind: ClusterRole

docker/devbox-bundled/manifests/complete.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7873,7 +7873,9 @@ metadata:
78737873
---
78747874
apiVersion: v1
78757875
data:
7876+
allow-http-registry: "true"
78767877
queue-sidecar-image: gcr.io/knative-releases/knative.dev/serving/cmd/queue@sha256:d0be939fdfb469e52e999eb65f39466d18f029984a782affa26322c9fec6db78
7878+
registries-skipping-tag-resolving: localhost:30000,kind-registry:5000
78777879
kind: ConfigMap
78787880
metadata:
78797881
annotations:

docker/devbox-bundled/manifests/dev.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7589,7 +7589,9 @@ metadata:
75897589
---
75907590
apiVersion: v1
75917591
data:
7592+
allow-http-registry: "true"
75927593
queue-sidecar-image: gcr.io/knative-releases/knative.dev/serving/cmd/queue@sha256:d0be939fdfb469e52e999eb65f39466d18f029984a782affa26322c9fec6db78
7594+
registries-skipping-tag-resolving: localhost:30000,kind-registry:5000
75937595
kind: ConfigMap
75947596
metadata:
75957597
annotations:

docs/BACKEND_README.md

Lines changed: 167 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,167 @@
1+
# Flyte 2 Backend
2+
3+
This repository contains the backend infrastructure for deploying a distributed, multi-node version of Flyte 2. The backend is **Kubernetes-native** — it orchestrates workflow execution using Kubernetes primitives, scheduling tasks as pods across clusters with built-in support for multi-cluster routing, service account-based identity, and pod-level log tracking. The core architecture consists of gRPC services (QueueService, RunService, StateService) backed by PostgreSQL, using async processing and real-time streaming via PostgreSQL LISTEN/NOTIFY. See the full [Implementation Spec](https://github.com/flyteorg/flyte/blob/v2/docs/IMPLEMENTATION_SPEC.md) for details.
4+
5+
This repo also defines the protocol buffer schemas for Flyte's APIs and generates client libraries for Go, TypeScript, Python, and Rust. Deploy this when you need Flyte running as a scalable, distributed service across your organization.
6+
7+
**Want to contribute?** Join us on [slack.flyte.org](https://slack.flyte.org) to get involved.
8+
9+
## Repository Structure
10+
11+
```
12+
flyte/
13+
├── flyteidl2/ # Protocol buffer definitions
14+
│ ├── common/ # Common types and utilities
15+
│ ├── core/ # Core Flyte types (tasks, workflows, literals)
16+
│ ├── imagebuilder/ # Image builder service definitions
17+
│ ├── logs/ # Logging types
18+
│ ├── secret/ # Secret management types
19+
│ ├── task/ # Task execution types
20+
│ ├── trigger/ # Trigger service definitions
21+
│ ├── workflow/ # Workflow types
22+
│ └── gen_utils/ # Language-specific generation utilities
23+
├── gen/ # Generated code (not checked into version control)
24+
│ ├── go/ # Generated Go code
25+
│ ├── ts/ # Generated TypeScript code
26+
│ ├── python/ # Generated Python code
27+
│ └── rust/ # Generated Rust code
28+
├── buf.yaml # Buf configuration
29+
├── buf.gen.*.yaml # Language-specific generation configs
30+
└── Makefile # Build automation
31+
```
32+
33+
## Prerequisites
34+
35+
- [Buf CLI](https://buf.build/docs/installation) - Protocol buffer tooling
36+
- Go 1.24.6 or later
37+
- Node.js/npm (for TypeScript generation)
38+
- Python 3.9+ with `uv` package manager (for Python generation)
39+
- Rust toolchain (for Rust generation)
40+
41+
## Quick Start
42+
43+
### Generate All Code
44+
45+
To generate code for all supported languages:
46+
47+
```bash
48+
make gen
49+
```
50+
51+
This will:
52+
1. Update buf dependencies
53+
2. Format and lint proto files
54+
3. Generate code for Go, TypeScript, Python, and Rust
55+
4. Generate mocks for Go
56+
5. Run `go mod tidy`
57+
58+
### Generate for Specific Languages Locally
59+
60+
```bash
61+
make buf-go # Generate Go code only
62+
make buf-ts # Generate TypeScript code only
63+
make buf-python # Generate Python code only
64+
make buf-rust # Generate Rust code only
65+
```
66+
67+
## Making Changes
68+
69+
### 1. Modify Protocol Buffers
70+
71+
Edit `.proto` files in the `flyteidl2/` directory following these guidelines:
72+
- Follow the existing naming conventions
73+
- Use proper protobuf style (snake_case for fields, PascalCase for messages)
74+
- Add appropriate comments and documentation
75+
- Ensure backward compatibility when modifying existing messages
76+
77+
### 2. Generate Code
78+
79+
After modifying proto files:
80+
81+
```bash
82+
make docker-pull # Pull the docker image for generation
83+
make gen
84+
```
85+
86+
### 3. Verify Your Changes
87+
88+
Run the following to ensure everything builds correctly:
89+
90+
```bash
91+
# For Go
92+
make go-tidy
93+
go build ./...
94+
95+
# For Rust
96+
make build-crate
97+
98+
# For Python
99+
cd gen/python && uv lock
100+
101+
# For TypeScript
102+
cd gen/ts && npm install
103+
```
104+
105+
### 4. Generate Mocks (Go only)
106+
107+
If you've added or modified Go interfaces:
108+
109+
```bash
110+
make gen
111+
```
112+
113+
## Development Workflow
114+
115+
1. **Format proto files**: `make buf-format`
116+
2. **Lint proto files**: `make buf-lint`
117+
3. **Generate code**: `make buf` or `make gen`
118+
4. **Verify builds**: Build generated code in your target language
119+
5. **Commit changes**: Commit both proto files and generated code
120+
121+
## Common Tasks
122+
123+
### Update Buf Dependencies
124+
125+
```bash
126+
make gen
127+
```
128+
129+
### View Available Commands
130+
131+
```bash
132+
make help
133+
```
134+
135+
## Versioning and Releases
136+
137+
See [CONTRIBUTING.md](CONTRIBUTING.md) for detailed release instructions.
138+
139+
## Generated Code
140+
141+
The `gen/` directory contains auto-generated code and should not be manually edited. Changes to generated code should be made by:
142+
1. Modifying the source `.proto` files in `flyteidl2/`
143+
2. Updating generation utilities in `flyteidl2/gen_utils/` if needed
144+
3. Running `make gen` to regenerate all code
145+
146+
## Troubleshooting
147+
148+
### Buf Errors
149+
- Ensure you have the latest version of Buf: `buf --version`
150+
- Update dependencies: `make buf-dep`
151+
- Check `buf.lock` for dependency conflicts
152+
153+
### Go Module Issues
154+
- Run `make go-tidy` to clean up dependencies
155+
- Ensure you're using Go 1.24.6 or later
156+
157+
### Python Generation Issues
158+
- Ensure `uv` is installed: `pip install uv`
159+
- Set the environment variable: `export SETUPTOOLS_SCM_PRETEND_VERSION=0.0.0`
160+
161+
### Rust Build Issues
162+
- Update Rust toolchain: `rustup update`
163+
- Navigate to `gen/rust` and run `cargo update`
164+
165+
## Contributing
166+
167+
We welcome contributions to Flyte 2! Please follow the guide [here](CONTRIBUTING.md).

0 commit comments

Comments
 (0)