Skip to content

Commit 9c9f37d

Browse files
committed
Show final config in simulaor default logger at Info lvel
Signed-off-by: Qifan Deng <[email protected]>
1 parent 21957bc commit 9c9f37d

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

pkg/llm-d-inference-sim/simulator.go

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,8 +114,14 @@ func (s *VllmSimulator) Start(ctx context.Context) error {
114114
if err != nil {
115115
return err
116116
}
117+
117118
s.config = config
118119

120+
err = s.showConfig(s.logger)
121+
if err != nil {
122+
return err
123+
}
124+
119125
for _, lora := range config.LoraModules {
120126
s.loraAdaptors.Store(lora.Name, "")
121127
}
@@ -708,3 +714,17 @@ func (s *VllmSimulator) getDisplayedModelName(reqModel string) string {
708714
}
709715
return s.config.ServedModelNames[0]
710716
}
717+
718+
func (s *VllmSimulator) showConfig(tgtLgr logr.Logger) error {
719+
if tgtLgr == logr.Discard() {
720+
err := fmt.Errorf("target logger is nil, cannot show configuration")
721+
return err
722+
}
723+
config := s.config
724+
cfgJSON, err := json.MarshalIndent(config, "", " ")
725+
if err != nil {
726+
return fmt.Errorf("failed to marshal configuration to JSON: %w", err)
727+
}
728+
tgtLgr.Info("Final simulator configuration:", "config", string(cfgJSON))
729+
return nil
730+
}

0 commit comments

Comments
 (0)