MCPcopy Create free account
hub / github.com/sql-machine-learning/sqlflow / runProgram

Method runProgram

go/executor/executor.go:181–196  ·  view source on GitHub ↗
(program string, logStderr bool)

Source from the content-addressed store, hash-verified

179}
180
181func (s *pythonExecutor) runProgram(program string, logStderr bool) error {
182 cmd := sqlflowCmd(s.Cwd, s.Db.DriverName)
183 cmd.Stdin = bytes.NewBufferString(program)
184
185 errorLog, e := s.runCommand(cmd, nil, logStderr)
186 if e != nil {
187 // return the diagnostic message
188 sub := rePyDiagnostics.FindStringSubmatch(errorLog)
189 if len(sub) == 2 {
190 return fmt.Errorf("%s", sub[1])
191 }
192 // if no diagnostic message, return the full stack trace
193 return fmt.Errorf("failed: %v\n%sGenerated Code:%[2]s\n%s\n%[2]sOutput%[2]s\n%[4]v", e, "==========", program, errorLog)
194 }
195 return nil
196}
197
198func (s *pythonExecutor) runCommand(cmd *exec.Cmd, context map[string]string, logStderr bool) (string, error) {
199 cw := &logChanWriter{wr: s.Writer}

Callers 7

ExecuteTrainMethod · 0.95
ExecutePredictMethod · 0.95
ExecuteExplainMethod · 0.95
ExecuteEvaluateMethod · 0.95
ExecuteOptimizeMethod · 0.95
ExecuteTrainMethod · 0.80

Calls 3

runCommandMethod · 0.95
sqlflowCmdFunction · 0.85
ErrorfMethod · 0.80

Tested by

no test coverage detected