Skip to content

Commit a667963

Browse files
QinYuuuuDev AgentHaiHui886
authored
Add service name to deployment response (#680)
Co-authored-by: Dev Agent <dev-agent@example.com> Co-authored-by: HaiHui <154984842+HaiHui886@users.noreply.github.com>
1 parent fd716ea commit a667963

File tree

4 files changed

+8
-1
lines changed

4 files changed

+8
-1
lines changed

AGENTS.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ Folders relative to the root of the repository for each service:
3636
| Runner | runner |
3737
| LogCollector | logcollector |
3838

39-
## Examples
39+
## Function Examples
4040

4141
### Router
4242

@@ -74,6 +74,10 @@ Folders relative to the root of the repository for each service:
7474
- `runner/component/service.go` implements runner component to trigger deploy process by call knative api.
7575
- `docker/spaces/builder/Dockerfile*` are Dockerfile that builds the space image.
7676

77+
### Cluster
78+
79+
- `component/cluster.go` is a component that deals with cluster-related business logic.
80+
7781
## Code Style & Conventions:
7882

7983
- Each layer's interface should only expose data structures defined within its own layer or common type definitions from the common.types package. For example, interfaces in the Component layer (such as UserComponent) should not return data structures from the underlying database layer (such as database.User structure), as the database layer is considered lower-level than the component layer.

common/types/cluster.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ type DeployRes struct {
6565
Status string `json:"status"`
6666
TotalTimeInMin int `json:"total_time_in_min"`
6767
TotalFeeInCents int `json:"total_fee_in_cents"`
68+
SvcName string `json:"svc_name"` // service name of the deployment, used for inference endpoint
6869
}
6970

7071
type NodeResourceInfo struct {

component/cluster.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,7 @@ func (c *clusterComponentImpl) GetDeploys(ctx context.Context, req types.DeployR
221221
Resource: deploy.Hardware,
222222
TotalTimeInMin: totalTime,
223223
TotalFeeInCents: totalFee,
224+
SvcName: deploy.SvcName,
224225
})
225226
}
226227
return res, total, nil

component/cluster_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,7 @@ func TestClusterComponent_GetDeploys(t *testing.T) {
164164
require.Equal(t, "cpu=2,memory=4Gi", res[0].Resource)
165165
require.Equal(t, 200, res[0].TotalTimeInMin)
166166
require.Equal(t, 123, res[0].TotalFeeInCents)
167+
require.Equal(t, "service-1", res[0].SvcName)
167168
}
168169

169170
func TestClusterComponent_GetClusterByID(t *testing.T) {

0 commit comments

Comments
 (0)