MCPcopy Create free account
hub / github.com/github/gh-aw / extractEngineFromAwInfo

Function extractEngineFromAwInfo

pkg/cli/logs_parsing_core.go:82–109  ·  view source on GitHub ↗

extractEngineFromAwInfo reads aw_info.json and returns the appropriate engine Handles cases where aw_info.json is a file or a directory containing the actual file

(infoFilePath string, verbose bool)

Source from the content-addressed store, hash-verified

80// extractEngineFromAwInfo reads aw_info.json and returns the appropriate engine
81// Handles cases where aw_info.json is a file or a directory containing the actual file
82func extractEngineFromAwInfo(infoFilePath string, verbose bool) workflow.CodingAgentEngine {
83 logsParsingCoreLog.Printf("Extracting engine from aw_info.json: %s", infoFilePath)
84 info, err := parseAwInfo(infoFilePath, verbose)
85 if err != nil {
86 return nil
87 }
88
89 if info.EngineID == "" {
90 logsParsingCoreLog.Print("No engine_id found in aw_info.json")
91 if verbose {
92 fmt.Fprintln(os.Stderr, console.FormatWarningMessage("No engine_id found in aw_info.json"))
93 }
94 return nil
95 }
96
97 registry := workflow.GetGlobalEngineRegistry()
98 engine, err := registry.GetEngine(info.EngineID)
99 if err != nil {
100 logsParsingCoreLog.Printf("Unknown engine: %s", info.EngineID)
101 if verbose {
102 fmt.Fprintln(os.Stderr, console.FormatWarningMessage("Unknown engine in aw_info.json: "+info.EngineID))
103 }
104 return nil
105 }
106
107 logsParsingCoreLog.Printf("Successfully extracted engine: %s", engine.GetID())
108 return engine
109}

Callers 5

extractLogMetricsFunction · 0.85
parseAgentLogIfRequestedFunction · 0.85
DownloadWorkflowLogsFunction · 0.85

Calls 7

FormatWarningMessageFunction · 0.92
GetGlobalEngineRegistryFunction · 0.92
parseAwInfoFunction · 0.85
PrintMethod · 0.80
GetEngineMethod · 0.80
GetIDMethod · 0.65
PrintfMethod · 0.45