Skip to content

Commit

Permalink
fix: f3: Keep retrying the task forever (#337)
Browse files Browse the repository at this point in the history
* fix: f3: Keep retrying the task forever

* Update tasks/f3/f3_task.go

Co-authored-by: Jakub Sztandera <[email protected]>

* make gen

---------

Co-authored-by: Jakub Sztandera <[email protected]>
  • Loading branch information
magik6k and Kubuxu authored Dec 6, 2024
1 parent 8ef2cd0 commit 738bba9
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion tasks/f3/f3_task.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"time"

logging "github.com/ipfs/go-log/v2"
"github.com/yugabyte/pgx/v5"
"golang.org/x/xerrors"

"github.com/filecoin-project/go-address"
Expand Down Expand Up @@ -71,6 +72,12 @@ func (f *F3Task) Do(taskID harmonytask.TaskID, stillOwned func() bool) (done boo
var spID int64
err = f.db.QueryRow(ctx, "SELECT sp_id FROM f3_tasks WHERE task_id = $1", taskID).Scan(&spID)
if err != nil {
if err == pgx.ErrNoRows {
// can only happen when the SP ID was removed from the cluster configuration
log.Warnw("marking f3 task with no corresponding spid as done", "task", taskID)
return true, nil
}

return false, xerrors.Errorf("failed to get sp_id: %w", err)
}

Expand Down Expand Up @@ -195,7 +202,10 @@ func (f *F3Task) TypeDetails() harmonytask.TaskTypeDetails {
Gpu: 0,
Ram: 10 << 20,
},
MaxFailures: 1,
// No MaxRetries, never kill this task
RetryWait: func(retries int) time.Duration {
return time.Minute
},
}
}

Expand Down

0 comments on commit 738bba9

Please sign in to comment.