From 494b5d91ddc25ea04fd61e4ba1664355e25be70f Mon Sep 17 00:00:00 2001 From: Brad P <0xb79orch@gmail.com> Date: Mon, 6 May 2024 12:11:04 -0500 Subject: [PATCH] add AI worker option to not use managed containers --- cmd/livepeer/livepeer.go | 1 + cmd/livepeer/starter/starter.go | 155 ++++++++++++++++---------------- 2 files changed, 80 insertions(+), 76 deletions(-) diff --git a/cmd/livepeer/livepeer.go b/cmd/livepeer/livepeer.go index 4b9f01ecf8..add1626ee9 100755 --- a/cmd/livepeer/livepeer.go +++ b/cmd/livepeer/livepeer.go @@ -153,6 +153,7 @@ func parseLivepeerConfig() starter.LivepeerConfig { cfg.AIWorker = flag.Bool("aiWorker", *cfg.AIWorker, "Set to true to run an AI worker") cfg.AIModels = flag.String("aiModels", *cfg.AIModels, "Set models (pipeline:model_id) for AI worker to load upon initialization") cfg.AIModelsDir = flag.String("aiModelsDir", *cfg.AIModelsDir, "Set directory where AI model weights are stored") + cfg.AIWorkerNoManagedContainers = flag.Bool("aiWorkerNoManagedContainers", *cfg.AIWorkerNoManagedContainers, "set to true if want to no use managed containers with AI worker") // Onchain: cfg.EthAcctAddr = flag.String("ethAcctAddr", *cfg.EthAcctAddr, "Existing Eth account address. For use when multiple ETH accounts exist in the keystore directory") diff --git a/cmd/livepeer/starter/starter.go b/cmd/livepeer/starter/starter.go index e612732a08..80bb37ed2e 100755 --- a/cmd/livepeer/starter/starter.go +++ b/cmd/livepeer/starter/starter.go @@ -77,78 +77,79 @@ const ( ) type LivepeerConfig struct { - Network *string - RtmpAddr *string - CliAddr *string - HttpAddr *string - ServiceAddr *string - OrchAddr *string - VerifierURL *string - EthController *string - VerifierPath *string - LocalVerify *bool - HttpIngest *bool - Orchestrator *bool - Transcoder *bool - AIWorker *bool - Broadcaster *bool - OrchSecret *string - TranscodingOptions *string - AIModels *string - MaxAttempts *int - SelectRandWeight *float64 - SelectStakeWeight *float64 - SelectPriceWeight *float64 - SelectPriceExpFactor *float64 - OrchPerfStatsURL *string - Region *string - MaxPricePerUnit *int - MinPerfScore *float64 - MaxSessions *string - CurrentManifest *bool - Nvidia *string - Netint *string - TestTranscoder *bool - EthAcctAddr *string - EthPassword *string - EthKeystorePath *string - EthOrchAddr *string - EthUrl *string - TxTimeout *time.Duration - MaxTxReplacements *int - GasLimit *int - MinGasPrice *int64 - MaxGasPrice *int - InitializeRound *bool - TicketEV *string - MaxFaceValue *string - MaxTicketEV *string - MaxTotalEV *string - DepositMultiplier *int - PricePerUnit *int - PixelsPerUnit *int - AutoAdjustPrice *bool - PricePerBroadcaster *string - BlockPollingInterval *int - Redeemer *bool - RedeemerAddr *string - Reward *bool - Monitor *bool - MetricsPerStream *bool - MetricsExposeClientIP *bool - MetadataQueueUri *string - MetadataAmqpExchange *string - MetadataPublishTimeout *time.Duration - Datadir *string - AIModelsDir *string - Objectstore *string - Recordstore *string - FVfailGsBucket *string - FVfailGsKey *string - AuthWebhookURL *string - OrchWebhookURL *string - OrchBlacklist *string - TestOrchAvail *bool + Network *string + RtmpAddr *string + CliAddr *string + HttpAddr *string + ServiceAddr *string + OrchAddr *string + VerifierURL *string + EthController *string + VerifierPath *string + LocalVerify *bool + HttpIngest *bool + Orchestrator *bool + Transcoder *bool + AIWorker *bool + Broadcaster *bool + OrchSecret *string + TranscodingOptions *string + AIModels *string + AIWorkerNoManagedContainers *bool + MaxAttempts *int + SelectRandWeight *float64 + SelectStakeWeight *float64 + SelectPriceWeight *float64 + SelectPriceExpFactor *float64 + OrchPerfStatsURL *string + Region *string + MaxPricePerUnit *int + MinPerfScore *float64 + MaxSessions *string + CurrentManifest *bool + Nvidia *string + Netint *string + TestTranscoder *bool + EthAcctAddr *string + EthPassword *string + EthKeystorePath *string + EthOrchAddr *string + EthUrl *string + TxTimeout *time.Duration + MaxTxReplacements *int + GasLimit *int + MinGasPrice *int64 + MaxGasPrice *int + InitializeRound *bool + TicketEV *string + MaxFaceValue *string + MaxTicketEV *string + MaxTotalEV *string + DepositMultiplier *int + PricePerUnit *int + PixelsPerUnit *int + AutoAdjustPrice *bool + PricePerBroadcaster *string + BlockPollingInterval *int + Redeemer *bool + RedeemerAddr *string + Reward *bool + Monitor *bool + MetricsPerStream *bool + MetricsExposeClientIP *bool + MetadataQueueUri *string + MetadataAmqpExchange *string + MetadataPublishTimeout *time.Duration + Datadir *string + AIModelsDir *string + Objectstore *string + Recordstore *string + FVfailGsBucket *string + FVfailGsKey *string + AuthWebhookURL *string + OrchWebhookURL *string + OrchBlacklist *string + TestOrchAvail *bool } // DefaultLivepeerConfig creates LivepeerConfig exactly the same as when no flags are passed to the livepeer process. @@ -187,6 +188,7 @@ func DefaultLivepeerConfig() LivepeerConfig { defaultAIWorker := false defaultAIModels := "" defaultAIModelsDir := "" + defaultAIWorkerNoManagedContainers := false // Onchain: defaultEthAcctAddr := "" @@ -273,9 +275,10 @@ func DefaultLivepeerConfig() LivepeerConfig { TestTranscoder: &defaultTestTranscoder, // AI: - AIWorker: &defaultAIWorker, - AIModels: &defaultAIModels, - AIModelsDir: &defaultAIModelsDir, + AIWorker: &defaultAIWorker, + AIModels: &defaultAIModels, + AIModelsDir: &defaultAIModelsDir, + AIWorkerNoManagedContainers: &defaultAIWorkerNoManagedContainers, // Onchain: EthAcctAddr: &defaultEthAcctAddr, @@ -525,7 +528,7 @@ func StartLivepeer(ctx context.Context, cfg LivepeerConfig) { return } - n.AIWorker, err = worker.NewWorker(aiWorkerContainerImageID, gpus, modelsDir) + n.AIWorker, err = worker.NewWorker(aiWorkerContainerImageID, gpus, modelsDir, *cfg.AIWorkerNoManagedContainers) if err != nil { glog.Errorf("Error starting AI worker: %v", err) return