Skip to content

Commit

Permalink
feat: default to enable pow (#203)
Browse files Browse the repository at this point in the history
Co-authored-by: hunjixin <16705420332lee@gmai.com>
  • Loading branch information
hunjixin and hunjixin authored Jun 27, 2024
1 parent 666cbb6 commit 44ef08d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions pkg/options/resource-provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ func NewResourceProviderOptions() resourceprovider.ResourceProviderOptions {

func GetDefaultResourceProviderPowOptions() resourceprovider.ResourceProviderPowOptions {
return resourceprovider.ResourceProviderPowOptions{
EnablePow: GetDefaultServeOptionBool("ENABLE_POW", false),
DisablePow: GetDefaultServeOptionBool("DISABLE_POW", false),
NumWorkers: GetDefaultServeOptionInt("NUM_WORKER", 0),

CudaGridSize: GetDefaultServeOptionInt("CUDA_GRID_SIZE", 256),
Expand Down Expand Up @@ -85,12 +85,12 @@ func AddResourceProviderOfferCliFlags(cmd *cobra.Command, offerOptions *resource

func AddResourceProviderPowCliFlags(cmd *cobra.Command, options *resourceprovider.ResourceProviderPowOptions) {
cmd.PersistentFlags().BoolVar(
&options.EnablePow, "enable-pow", options.EnablePow,
`Start pow mining (ENABLE_POW)`,
&options.DisablePow, "disable-pow", options.DisablePow,
`Disable pow mining (DISABLE_POW)`,
)
cmd.PersistentFlags().IntVar(
&options.NumWorkers, "num-worker", options.NumWorkers,
`Start pow mining (NUM_WORKER)`,
`Pow worker number (NUM_WORKER)`,
)

cmd.PersistentFlags().IntVar(
Expand Down
4 changes: 2 additions & 2 deletions pkg/resourceprovider/resourceprovider.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ type ResourceProviderOfferOptions struct {

// this configures the pow we will keep track of
type ResourceProviderPowOptions struct {
EnablePow bool
DisablePow bool
NumWorkers int

CudaGridSize int
Expand Down Expand Up @@ -91,7 +91,7 @@ func NewResourceProvider(
}

func (resourceProvider *ResourceProvider) Start(ctx context.Context, cm *system.CleanupManager) chan error {
if resourceProvider.options.Pow.EnablePow {
if !resourceProvider.options.Pow.DisablePow {
go resourceProvider.StartMineLoop(ctx)
}
return resourceProvider.controller.Start(ctx, cm)
Expand Down

0 comments on commit 44ef08d

Please sign in to comment.