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

Function createPAIHyperParamFile

go/executor/pai.go:115–142  ·  view source on GitHub ↗
(cwd string, filename string, modelPath string)

Source from the content-addressed store, hash-verified

113}
114
115func createPAIHyperParamFile(cwd string, filename string, modelPath string) error {
116 f, err := os.Create(fmt.Sprintf(path.Join(cwd, filename)))
117 if err != nil {
118 return err
119 }
120 defer f.Close()
121 ossAk := os.Getenv("SQLFLOW_OSS_AK")
122 ossSk := os.Getenv("SQLFLOW_OSS_SK")
123 ossEp := os.Getenv("SQLFLOW_OSS_MODEL_ENDPOINT")
124 if ossAk == "" || ossSk == "" || ossEp == "" {
125 return fmt.Errorf("must define SQLFLOW_OSS_AK, SQLFLOW_OSS_SK, SQLFLOW_OSS_MODEL_ENDPOINT when submitting to PAI")
126 }
127
128 if _, err := f.Write([]byte(fmt.Sprintf("sqlflow_oss_ak=\"%s\"\n", ossAk))); err != nil {
129 return err
130 }
131 if _, err := f.Write([]byte(fmt.Sprintf("sqlflow_oss_sk=\"%s\"\n", ossSk))); err != nil {
132 return err
133 }
134 if _, err := f.Write([]byte(fmt.Sprintf("sqlflow_oss_ep=\"%s\"\n", ossEp))); err != nil {
135 return err
136 }
137 ossModelURL := pai.OSSModelURL(modelPath)
138 if _, err := f.Write([]byte(fmt.Sprintf("sqlflow_oss_modeldir=\"%s\"\n", ossModelURL))); err != nil {
139 return err
140 }
141 return nil
142}
143
144func preExecuteTrainOnPAI(cl *ir.TrainStmt, session *pb.Session) (e error) {
145 // create tmp table for training and validating

Callers 8

ExecuteTrainMethod · 0.85
ExecutePredictMethod · 0.85
ExecuteExplainMethod · 0.85
ExecuteEvaluateMethod · 0.85
ExecuteTrainMethod · 0.85
ExecutePredictMethod · 0.85
ExecuteExplainMethod · 0.85
ExecuteEvaluateMethod · 0.85

Calls 4

OSSModelURLFunction · 0.92
ErrorfMethod · 0.80
CloseMethod · 0.45
WriteMethod · 0.45

Tested by

no test coverage detected