sector import: Plumb sector download task canfig

This commit is contained in:
Łukasz Magiera 2022-09-06 11:06:30 +02:00
parent 12a8ab5ac7
commit 9c6d531ae7
10 changed files with 30 additions and 6 deletions

View File

@ -224,6 +224,12 @@ var runCmd = &cli.Command{
Value: true, Value: true,
EnvVars: []string{"LOTUS_WORKER_REGEN_SECTOR_KEY"}, EnvVars: []string{"LOTUS_WORKER_REGEN_SECTOR_KEY"},
}, },
&cli.BoolFlag{
Name: "sector-download",
Usage: "enable external sector data download",
Value: false,
EnvVars: []string{"LOTUS_WORKER_SECTOR_DOWNLOAD"},
},
&cli.BoolFlag{ &cli.BoolFlag{
Name: "windowpost", Name: "windowpost",
Usage: "enable window post", Usage: "enable window post",
@ -373,6 +379,9 @@ var runCmd = &cli.Command{
if (workerType == sealtasks.WorkerSealing || cctx.IsSet("addpiece")) && cctx.Bool("addpiece") { if (workerType == sealtasks.WorkerSealing || cctx.IsSet("addpiece")) && cctx.Bool("addpiece") {
taskTypes = append(taskTypes, sealtasks.TTAddPiece, sealtasks.TTDataCid) taskTypes = append(taskTypes, sealtasks.TTAddPiece, sealtasks.TTDataCid)
} }
if (workerType == sealtasks.WorkerSealing || cctx.IsSet("sector-download")) && cctx.Bool("sector-download") {
taskTypes = append(taskTypes, sealtasks.TTDownloadSector)
}
if (workerType == sealtasks.WorkerSealing || cctx.IsSet("precommit1")) && cctx.Bool("precommit1") { if (workerType == sealtasks.WorkerSealing || cctx.IsSet("precommit1")) && cctx.Bool("precommit1") {
taskTypes = append(taskTypes, sealtasks.TTPreCommit1) taskTypes = append(taskTypes, sealtasks.TTPreCommit1)
} }

View File

@ -53,6 +53,7 @@ OPTIONS:
--prove-replica-update2 enable prove replica update 2 (default: true) [$LOTUS_WORKER_PROVE_REPLICA_UPDATE2] --prove-replica-update2 enable prove replica update 2 (default: true) [$LOTUS_WORKER_PROVE_REPLICA_UPDATE2]
--regen-sector-key enable regen sector key (default: true) [$LOTUS_WORKER_REGEN_SECTOR_KEY] --regen-sector-key enable regen sector key (default: true) [$LOTUS_WORKER_REGEN_SECTOR_KEY]
--replica-update enable replica update (default: true) [$LOTUS_WORKER_REPLICA_UPDATE] --replica-update enable replica update (default: true) [$LOTUS_WORKER_REPLICA_UPDATE]
--sector-download enable external sector data download (default: false) [$LOTUS_WORKER_SECTOR_DOWNLOAD]
--timeout value used when 'listen' is unspecified. must be a valid duration recognized by golang's time.ParseDuration function (default: "30m") [$LOTUS_WORKER_TIMEOUT] --timeout value used when 'listen' is unspecified. must be a valid duration recognized by golang's time.ParseDuration function (default: "30m") [$LOTUS_WORKER_TIMEOUT]
--unseal enable unsealing (32G sectors: 1 core, 128GiB Memory) (default: true) [$LOTUS_WORKER_UNSEAL] --unseal enable unsealing (32G sectors: 1 core, 128GiB Memory) (default: true) [$LOTUS_WORKER_UNSEAL]
--windowpost enable window post (default: false) [$LOTUS_WORKER_WINDOWPOST] --windowpost enable window post (default: false) [$LOTUS_WORKER_WINDOWPOST]

View File

@ -612,8 +612,10 @@
# env var: LOTUS_STORAGE_PARALLELFETCHLIMIT # env var: LOTUS_STORAGE_PARALLELFETCHLIMIT
#ParallelFetchLimit = 10 #ParallelFetchLimit = 10
# Local worker config # type: bool
# # env var: LOTUS_STORAGE_ALLOWSECTORDOWNLOAD
#AllowSectorDownload = true
# type: bool # type: bool
# env var: LOTUS_STORAGE_ALLOWADDPIECE # env var: LOTUS_STORAGE_ALLOWADDPIECE
#AllowAddPiece = true #AllowAddPiece = true

View File

@ -636,6 +636,7 @@ func (n *Ensemble) Start() *Ensemble {
scfg := config.DefaultStorageMiner() scfg := config.DefaultStorageMiner()
if noLocal { if noLocal {
scfg.Storage.AllowSectorDownload = false
scfg.Storage.AllowAddPiece = false scfg.Storage.AllowAddPiece = false
scfg.Storage.AllowPreCommit1 = false scfg.Storage.AllowPreCommit1 = false
scfg.Storage.AllowPreCommit2 = false scfg.Storage.AllowPreCommit2 = false

View File

@ -161,8 +161,7 @@ func TestSectorImportAfterPC2(t *testing.T) {
require.Len(t, ng, 1) require.Len(t, ng, 1)
require.Equal(t, snum, ng[0]) require.Equal(t, snum, ng[0])
// todo wait sealed miner.WaitSectorsProving(ctx, map[abi.SectorNumber]struct{}{snum: {}})
} }
func remoteGetSector(sectorRoot string) func(w http.ResponseWriter, r *http.Request) { func remoteGetSector(sectorRoot string) func(w http.ResponseWriter, r *http.Request) {

View File

@ -146,6 +146,7 @@ func DefaultStorageMiner() *StorageMiner {
}, },
Storage: SealerConfig{ Storage: SealerConfig{
AllowSectorDownload: true,
AllowAddPiece: true, AllowAddPiece: true,
AllowPreCommit1: true, AllowPreCommit1: true,
AllowPreCommit2: true, AllowPreCommit2: true,

View File

@ -796,11 +796,17 @@ This parameter is ONLY applicable if the retrieval pricing policy strategy has b
Comment: ``, Comment: ``,
}, },
{
Num: "AllowSectorDownload",
Type: "bool",
Comment: ``,
},
{ {
Name: "AllowAddPiece", Name: "AllowAddPiece",
Type: "bool", Type: "bool",
Comment: `Local worker config`, Comment: ``,
}, },
{ {
Name: "AllowPreCommit1", Name: "AllowPreCommit1",

View File

@ -54,6 +54,7 @@ func WriteStorageFile(path string, config paths.StorageConfig) error {
func (c *StorageMiner) StorageManager() sealer.Config { func (c *StorageMiner) StorageManager() sealer.Config {
return sealer.Config{ return sealer.Config{
ParallelFetchLimit: c.Storage.ParallelFetchLimit, ParallelFetchLimit: c.Storage.ParallelFetchLimit,
AllowSectorDownload: c.Storage.AllowSectorDownload,
AllowAddPiece: c.Storage.AllowAddPiece, AllowAddPiece: c.Storage.AllowAddPiece,
AllowPreCommit1: c.Storage.AllowPreCommit1, AllowPreCommit1: c.Storage.AllowPreCommit1,
AllowPreCommit2: c.Storage.AllowPreCommit2, AllowPreCommit2: c.Storage.AllowPreCommit2,

View File

@ -409,7 +409,7 @@ type SealingConfig struct {
type SealerConfig struct { type SealerConfig struct {
ParallelFetchLimit int ParallelFetchLimit int
// Local worker config AllowSectorDownload bool
AllowAddPiece bool AllowAddPiece bool
AllowPreCommit1 bool AllowPreCommit1 bool
AllowPreCommit2 bool AllowPreCommit2 bool

View File

@ -108,6 +108,7 @@ type Config struct {
ParallelFetchLimit int ParallelFetchLimit int
// Local worker config // Local worker config
AllowSectorDownload bool
AllowAddPiece bool AllowAddPiece bool
AllowPreCommit1 bool AllowPreCommit1 bool
AllowPreCommit2 bool AllowPreCommit2 bool
@ -182,6 +183,9 @@ func New(ctx context.Context, lstor *paths.Local, stor paths.Store, ls paths.Loc
localTasks := []sealtasks.TaskType{ localTasks := []sealtasks.TaskType{
sealtasks.TTCommit1, sealtasks.TTProveReplicaUpdate1, sealtasks.TTFinalize, sealtasks.TTFetch, sealtasks.TTFinalizeReplicaUpdate, sealtasks.TTCommit1, sealtasks.TTProveReplicaUpdate1, sealtasks.TTFinalize, sealtasks.TTFetch, sealtasks.TTFinalizeReplicaUpdate,
} }
if sc.AllowSectorDownload {
localTasks = append(localTasks, sealtasks.TTDownloadSector)
}
if sc.AllowAddPiece { if sc.AllowAddPiece {
localTasks = append(localTasks, sealtasks.TTAddPiece, sealtasks.TTDataCid) localTasks = append(localTasks, sealtasks.TTAddPiece, sealtasks.TTDataCid)
} }