Skip to content

Commit

Permalink
Fix: Record run tasks for clean and load
Browse files Browse the repository at this point in the history
If clean or load fails, we weren't recording the run ids.

Signed-off-by: Craig Jellick <[email protected]>
  • Loading branch information
cjellick committed Nov 6, 2024
1 parent 3d78282 commit b84d5d2
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions pkg/controller/handlers/knowledgefile/knowledgefile.go
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,9 @@ func (h *Handler) ingest(ctx context.Context, client kclient.Client, file *v1.Kn
defer task.Close()

file.Status.RunNames = append(file.Status.RunNames, task.Run.Name)
if err := client.Status().Update(ctx, file); err != nil {
return err
}

result, err := task.Result(ctx)
if err != nil {
Expand All @@ -185,13 +188,16 @@ func (h *Handler) ingest(ctx context.Context, client kclient.Client, file *v1.Kn
}
defer loadTask.Close()

file.Status.RunNames = append(file.Status.RunNames, loadTask.Run.Name)
if err := client.Status().Update(ctx, file); err != nil {
return err
}

_, err = loadTask.Result(ctx)
if err != nil {
return fmt.Errorf("failed to convert file: %v", err)
}

file.Status.RunNames = append(file.Status.RunNames, loadTask.Run.Name)

stat, err := h.gptScript.StatFileInWorkspace(ctx, outputFile(file.Spec.FileName), gptscript.StatFileInWorkspaceOptions{
WorkspaceID: thread.Status.WorkspaceID,
})
Expand Down

0 comments on commit b84d5d2

Please sign in to comment.