Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 Fix task group update. #645

Merged
merged 2 commits into from
Jun 6, 2024
Merged

Conversation

jortel
Copy link
Contributor

@jortel jortel commented Jun 6, 2024

Fix task group submit.
Update to follow error reporting pattern.

Signed-off-by: Jeff Ortel <jortel@redhat.com>
@jortel jortel requested a review from mansam June 6, 2024 17:16
})
return
}
}
Copy link
Contributor Author

@jortel jortel Jun 6, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hint: Since the update of a Ready task effectively submits it which creates all of the tasks, this check ensure the tasks are not created more than once.

Signed-off-by: Jeff Ortel <jortel@redhat.com>
@@ -221,17 +230,16 @@ func (h TaskGroupHandler) Update(ctx *gin.Context) {
for i := range m.Tasks {
task := &tasking.Task{}
task.With(&m.Tasks[i])
err = rtx.TaskManager.Update(h.DB(ctx), task)
err = rtx.TaskManager.Create(h.DB(ctx), task)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hint: main fix. should be creating the tasks, not updating them.

@@ -172,7 +173,7 @@ func (m *Manager) Update(db *gorm.DB, requested *Task) (err error) {
if err != nil {
return
}
switch requested.State {
switch task.State {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hint: conditional logic should be based on fetched task.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants