Skip to content

Commit b5351a9

Browse files
authored
Janky Fix: Extract input payloads for standalone tasks for dashboard (#3128)
* fix: extract input payload correctly * chore: todo -> fixme * fix: naming + handle panic
1 parent 4cdd468 commit b5351a9

File tree

4 files changed

+23
-2
lines changed

4 files changed

+23
-2
lines changed

api/v1/server/oas/transformers/v1/tasks.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,16 @@ func ToTask(taskWithData *v1.TaskWithPayloads, workflowRunExternalId uuid.UUID,
258258

259259
input := jsonToMap(taskWithData.InputPayload)
260260

261+
if taskWithData.IsStandalone {
262+
// fixme: improve this somehow - it's using this implicit assumption about how
263+
// we structure payloads, which it shouldn't
264+
if inputWithInternalHatchetData, ok := input["input"]; ok {
265+
if actualInput, ok := inputWithInternalHatchetData.(map[string]interface{}); ok {
266+
input = actualInput
267+
}
268+
}
269+
}
270+
261271
stepId := taskWithData.StepID
262272

263273
retryCount := int(taskWithData.RetryCount)

pkg/repository/olap.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -648,6 +648,7 @@ func (r *OLAPRepositoryImpl) ReadTaskRunData(ctx context.Context, tenantId uuid.
648648
ErrorMessage: taskRun.ErrorMessage,
649649
RetryCount: taskRun.RetryCount,
650650
OutputEventExternalID: taskRun.OutputEventExternalID,
651+
IsStandalone: taskRun.IsStandalone,
651652
},
652653
input,
653654
output,

pkg/repository/sqlcv1/olap.sql

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -511,6 +511,7 @@ WITH selected_retry_count AS (
511511
)
512512
SELECT
513513
t.*,
514+
(t.dag_id IS NULL)::BOOLEAN AS is_standalone,
514515
st.readable_status::v1_readable_status_olap as status,
515516
f.finished_at::timestamptz as finished_at,
516517
s.started_at::timestamptz as started_at,
@@ -567,7 +568,8 @@ WITH input AS (
567568
t.readable_status,
568569
t.parent_task_external_id,
569570
t.workflow_run_id,
570-
t.latest_retry_count
571+
t.latest_retry_count,
572+
t.dag_id
571573
FROM
572574
v1_tasks_olap t
573575
JOIN
@@ -689,6 +691,7 @@ SELECT
689691
END::JSONB AS input,
690692
t.readable_status::v1_readable_status_olap as status,
691693
t.workflow_run_id,
694+
(t.dag_id IS NULL)::BOOLEAN AS is_standalone,
692695
f.finished_at::timestamptz as finished_at,
693696
s.started_at::timestamptz as started_at,
694697
q.queued_at::timestamptz as queued_at,

pkg/repository/sqlcv1/olap.sql.go

Lines changed: 8 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)