Skip to content

Commit

Permalink
feat(models): log model source url
Browse files Browse the repository at this point in the history
Signed-off-by: Sunil Thaha <sthaha@redhat.com>
  • Loading branch information
sthaha committed Aug 29, 2024
1 parent 79a34f8 commit c84bfd0
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 6 deletions.
7 changes: 5 additions & 2 deletions pkg/model/node_component_energy.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,14 @@ func CreateNodeComponentPowerEstimatorModel(nodeFeatureNames, systemMetaDataFeat
var err error
nodeComponentPowerModel, err = createPowerModelEstimator(modelConfig)
if err != nil {
klog.Errorf("Failed to create %s/%s Model to estimate Node Component Power: %v", modelConfig.ModelType, modelConfig.ModelOutputType, err)
klog.Errorf("Failed to create %s/%s Model from %s to estimate Node Component Power: %v",
modelConfig.ModelType, modelConfig.ModelOutputType,
modelConfig.SourceURL(), err)
return
}

klog.V(1).Infof("Using the %s/%s Model to estimate Node Component Power", modelConfig.ModelType, modelConfig.ModelOutputType)
klog.V(1).Infof("Using the %s/%s Model from %s to estimate Node Component Power",
modelConfig.ModelType, modelConfig.ModelOutputType, modelConfig.SourceURL())
}

// IsNodeComponentPowerModelEnabled returns if the estimator has been enabled or not
Expand Down
7 changes: 5 additions & 2 deletions pkg/model/node_platform_energy.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,13 @@ func CreateNodePlatformPowerEstimatorModel(nodeFeatureNames, systemMetaDataFeatu
var err error
nodePlatformPowerModel, err = createPowerModelEstimator(modelConfig)
if err != nil {
klog.Errorf("Failed to create %s/%s Model to estimate Node Platform Power: %v", modelConfig.ModelType, modelConfig.ModelOutputType, err)
klog.Errorf("Failed to create %s/%s Model from %s to estimate Node Platform Power: %v",
modelConfig.ModelType, modelConfig.ModelOutputType,
modelConfig.SourceURL(), err)
return
}
klog.V(1).Infof("Using the %s/%s Model to estimate Node Platform Power", modelConfig.ModelType, modelConfig.ModelOutputType)
klog.V(1).Infof("Using the %s/%s Model from %s to estimate Node Platform Power",
modelConfig.ModelType, modelConfig.ModelOutputType, modelConfig.SourceURL())
}

// IsNodePlatformPowerModelEnabled returns if the estimator has been enabled or not
Expand Down
16 changes: 14 additions & 2 deletions pkg/model/types/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,18 @@ limitations under the License.

package types

type ModelType int
type ModelOutputType int
type (
ModelType int
ModelOutputType int
)

const (
// Power Model types
Ratio ModelType = iota + 1 // estimation happens within kepler without using Model Server
Regressor // estimation happens within kepler, but pre-trained model parameters are downloaded externally
EstimatorSidecar // estimation happens in the sidecar with a loaded pre-trained power model
)

const (
// Power Model Output types
// Absolute Power Model (AbsPower): is the power model trained by measured power (including the idle power)
Expand All @@ -33,6 +36,7 @@ const (
DynPower
Unsupported
)

const (
// Define energy source
PlatformEnergySource = "acpi"
Expand Down Expand Up @@ -99,3 +103,11 @@ type ModelConfig struct {
SystemMetaDataFeatureNames []string
SystemMetaDataFeatureValues []string
}

func (c *ModelConfig) SourceURL() string {
if c.InitModelURL != "" {
return c.InitModelURL
}

return c.InitModelFilepath
}

0 comments on commit c84bfd0

Please sign in to comment.