Merge pull request #1454 from filecoin-project/feat/wocker-task-flags

seal-worker: Task type flags
This commit is contained in:
Łukasz Magiera 2020-03-25 22:32:46 +01:00 committed by GitHub
commit 78b4872793
3 changed files with 40 additions and 8 deletions

View File

@ -118,16 +118,16 @@ var authApiInfoToken = &cli.Command{
log.Errorf("repoType type does not match the type of repo.RepoType")
}
addr, _, err := GetRawAPI(cctx, t)
ainfo, err := GetAPIInfo(cctx, t)
if err != nil {
return xerrors.Errorf("getting raw API: %w", err)
return xerrors.Errorf("could not get API info: %w", err)
}
envVar := envForRepo(t)
// TODO: Log in audit log when it is implemented
fmt.Printf("%s=%s:%s\n", envVar, string(token), addr)
fmt.Printf("%s=%s:%s\n", envVar, string(token), ainfo.Addr)
return nil
},
}

View File

@ -69,7 +69,7 @@ func main() {
Commands: local,
}
app.Setup()
app.Metadata["repoType"] = repo.StorageMiner
app.Metadata["repoType"] = repo.Worker
if err := app.Run(os.Args); err != nil {
log.Warnf("%+v", err)
@ -89,6 +89,21 @@ var runCmd = &cli.Command{
Name: "no-local-storage",
Usage: "don't use storageminer repo for sector storage",
},
&cli.BoolFlag{
Name: "precommit1",
Usage: "enable precommit1 (32G sectors: 1 core, 128GiB Memory)",
Value: true,
},
&cli.BoolFlag{
Name: "precommit2",
Usage: "enable precommit2 (32G sectors: all cores, 96GiB Memory)",
Value: true,
},
&cli.BoolFlag{
Name: "commit",
Usage: "enable commit (32G sectors: all cores or GPUs, 128GiB Memory + 64GiB swap)",
Value: true,
},
},
Action: func(cctx *cli.Context) error {
if !cctx.Bool("enable-gpu-proving") {
@ -130,9 +145,27 @@ var runCmd = &cli.Command{
return err
}
if cctx.Bool("commit") {
if err := paramfetch.GetParams(build.ParametersJson(), uint64(ssize)); err != nil {
return xerrors.Errorf("get params: %w", err)
}
}
var taskTypes []sealtasks.TaskType
if cctx.Bool("precommit1") {
taskTypes = append(taskTypes, sealtasks.TTPreCommit1)
}
if cctx.Bool("precommit2") {
taskTypes = append(taskTypes, sealtasks.TTPreCommit2)
}
if cctx.Bool("commit") {
taskTypes = append(taskTypes, sealtasks.TTCommit2)
}
if len(taskTypes) == 0 {
return xerrors.Errorf("no task types specified")
}
// Open repo
@ -226,7 +259,7 @@ var runCmd = &cli.Command{
workerApi := &worker{
LocalWorker: sectorstorage.NewLocalWorker(sectorstorage.WorkerConfig{
SealProof: spt,
TaskTypes: []sealtasks.TaskType{sealtasks.TTPreCommit1, sealtasks.TTPreCommit2, sealtasks.TTCommit2},
TaskTypes: taskTypes,
}, remote, localStore, nodeApi),
}

View File

@ -32,7 +32,6 @@ func (handler *FetchHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
}
func (handler *FetchHandler) remoteStatFs(w http.ResponseWriter, r *http.Request) {
log.Debugf("SERVE STAT %s", r.URL)
vars := mux.Vars(r)
id := ID(vars["id"])