TFLoadAndExplain generates PAI-TF explain program.
(ir *ir.ExplainStmt, session *pb.Session, modelPath string, expn *ExplainRender)
| 100 | |
| 101 | // TFLoadAndExplain generates PAI-TF explain program. |
| 102 | func TFLoadAndExplain(ir *ir.ExplainStmt, session *pb.Session, modelPath string, expn *ExplainRender) (string, error) { |
| 103 | var tpl = template.Must(template.New("Explain").Parse(tfExplainTmplText)) |
| 104 | ossModelDir := OSSModelURL(modelPath) |
| 105 | paiExplainTable := "" |
| 106 | if tensorflow.IsPAI() && ir.TmpExplainTable != "" { |
| 107 | paiExplainTable = ir.TmpExplainTable |
| 108 | } |
| 109 | filler := explainFiller{ |
| 110 | OSSModelDir: ossModelDir, |
| 111 | DataSource: session.DbConnStr, |
| 112 | Select: ir.Select, |
| 113 | ResultTable: ir.Into, |
| 114 | IsPAI: tensorflow.IsPAI(), |
| 115 | PAITable: paiExplainTable, |
| 116 | // TODO(weiguo): use GFile to write oss without ak/sk |
| 117 | // ref: https://yuque.antfin-inc.com/pai-user/manual/tf_oss_by_gfile |
| 118 | ResultOSSDest: expn.key, |
| 119 | ResultOSSAK: expn.ak, |
| 120 | ResultOSSSK: expn.sk, |
| 121 | ResultOSSEndpoint: expn.endpoint, |
| 122 | ResultOSSBucket: expn.bucket, |
| 123 | } |
| 124 | var code bytes.Buffer |
| 125 | if err := tpl.Execute(&code, filler); err != nil { |
| 126 | return "", err |
| 127 | } |
| 128 | return code.String(), nil |
| 129 | } |
| 130 | |
| 131 | // TFLoadAndEvaluate generates PAI-TF evaluate program. |
| 132 | func TFLoadAndEvaluate(ir *ir.EvaluateStmt, session *pb.Session, modelPath string) (string, error) { |
no test coverage detected