Skip to content

Commit 967b558

Browse files
committed
improve params field
1 parent fc26a3a commit 967b558

6 files changed

Lines changed: 156 additions & 148 deletions

File tree

api/v2/api.gen.go

Lines changed: 143 additions & 142 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

api/v2/api.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3057,7 +3057,7 @@ components:
30573057
description: "RFC3339 timestamp when execution completed"
30583058
params:
30593059
type: string
3060-
description: "Parameters passed to the DAG"
3060+
description: "JSON-serialized parameters passed to the DAG"
30613061

30623062
Node:
30633063
type: object

internal/core/execution/outputs.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,5 @@ type OutputsMetadata struct {
1313
AttemptID string `json:"attemptId"`
1414
Status string `json:"status"`
1515
CompletedAt string `json:"completedAt"`
16-
Params string `json:"params,omitempty"`
16+
Params string `json:"params,omitempty"` // JSON-serialized parameters
1717
}

internal/persistence/filedagrun/attempt_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -498,7 +498,7 @@ func TestAttempt_WriteOutputs(t *testing.T) {
498498
AttemptID: "attempt-1",
499499
Status: "succeeded",
500500
CompletedAt: "2024-12-28T15:30:45Z",
501-
Params: "key=value",
501+
Params: `["key=value"]`,
502502
},
503503
Outputs: map[string]string{
504504
"totalCount": "42",

internal/runtime/agent/agent.go

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import (
1111
"path/filepath"
1212
"regexp"
1313
"runtime/debug"
14-
"strings"
1514
"sync"
1615
"sync/atomic"
1716
"syscall"
@@ -686,14 +685,22 @@ func (a *Agent) buildOutputs(ctx context.Context, finalStatus core.Status) *exec
686685
return nil
687686
}
688687

688+
// Serialize params to JSON
689+
var paramsJSON string
690+
if len(a.dag.Params) > 0 {
691+
if data, err := json.Marshal(a.dag.Params); err == nil {
692+
paramsJSON = string(data)
693+
}
694+
}
695+
689696
return &execution.DAGRunOutputs{
690697
Metadata: execution.OutputsMetadata{
691698
DAGName: a.dag.Name,
692699
DAGRunID: a.dagRunID,
693700
AttemptID: a.dagRunAttemptID,
694701
Status: finalStatus.String(),
695702
CompletedAt: stringutil.FormatTime(time.Now()),
696-
Params: strings.Join(a.dag.Params, " "),
703+
Params: paramsJSON,
697704
},
698705
Outputs: outputs,
699706
}

internal/service/frontend/api/v2/dagruns.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -365,7 +365,7 @@ func (a *API) GetDAGRunOutputs(ctx context.Context, request api.GetDAGRunOutputs
365365
AttemptId: outputs.Metadata.AttemptID,
366366
Status: api.StatusLabel(outputs.Metadata.Status),
367367
CompletedAt: completedAt,
368-
Params: ptrOf(outputs.Metadata.Params),
368+
Params: &outputs.Metadata.Params,
369369
},
370370
Outputs: outputs.Outputs,
371371
}, nil

0 commit comments

Comments
 (0)