Skip to content

Commit

Permalink
set resource, move release func
Browse files Browse the repository at this point in the history
  • Loading branch information
LexLuthr committed Apr 29, 2024
1 parent 8fea86e commit 1e1d305
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
1 change: 0 additions & 1 deletion curiosrc/ffi/sdr_funcs.go
Original file line number Diff line number Diff line change
Expand Up @@ -640,7 +640,6 @@ func (sb *SealCalls) PreFetch(ctx context.Context, sector storiface.SectorRef, t
}

func (sb *SealCalls) TreeD(ctx context.Context, sector storiface.SectorRef, unsealed cid.Cid, size abi.PaddedPieceSize, data io.Reader, unpaddedData bool, fspaths, pathIDs storiface.SectorPaths, release func()) error {
defer release()
var err error
defer func() {
if err != nil {
Expand Down
7 changes: 4 additions & 3 deletions curiosrc/seal/task_treed.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ func (t *TreeDTask) TypeDetails() harmonytask.TaskTypeDetails {
Name: "TreeD",
Cost: resources.Resources{
Cpu: 1,
Ram: 64 << 20, // todo
Ram: 1 << 30,
Gpu: 0,
Storage: t.sc.Storage(t.taskToSector, storiface.FTNone, storiface.FTCache, ssize, storiface.PathSealing, 1.0),
},
Expand Down Expand Up @@ -122,6 +122,7 @@ func (t *TreeDTask) Do(taskID harmonytask.TaskID, stillOwned func() bool) (done
if err != nil {
return false, xerrors.Errorf("failed to prefetch sectors: %w", err)
}
defer release()

var pieces []struct {
PieceIndex int64 `db:"piece_index"`
Expand Down Expand Up @@ -248,10 +249,10 @@ func (t *TreeDTask) Do(taskID harmonytask.TaskID, stillOwned func() bool) (done
SET after_tree_d = true, tree_d_cid = $3 WHERE sp_id = $1 AND sector_number = $2`,
sectorParams.SpID, sectorParams.SectorNumber, commd)
if err != nil {
return false, xerrors.Errorf("store sdr-treeD success: updating pipeline: %w", err)
return false, xerrors.Errorf("store TreeD success: updating pipeline: %w", err)
}
if n != 1 {
return false, xerrors.Errorf("store sdr-treeD success: updated %d rows", n)
return false, xerrors.Errorf("store TreeD success: updated %d rows", n)
}

return true, nil
Expand Down
2 changes: 1 addition & 1 deletion storage/paths/local.go
Original file line number Diff line number Diff line change
Expand Up @@ -533,7 +533,7 @@ func (st *Local) Reserve(ctx context.Context, sid storiface.SectorRef, ft storif
}
}

return
return release, nil
}

// DoubleCallWrap wraps a function to make sure it's not called twice
Expand Down

0 comments on commit 1e1d305

Please sign in to comment.