(t *testing.T)
| 140 | } |
| 141 | |
| 142 | func TestPredictCodegen(t *testing.T) { |
| 143 | a := assert.New(t) |
| 144 | ir := ir.MockPredStmt(ir.MockTrainStmt(false)) |
| 145 | |
| 146 | os.Setenv("SQLFLOW_OSS_CHECKPOINT_CONFIG", "{\"host\": \"h.com\", \"arn\": \"acs:ram::9527:role\"}") |
| 147 | defer os.Unsetenv("SQLFLOW_OSS_CHECKPOINT_CONFIG") |
| 148 | sess := mockSession() |
| 149 | ossModelPath := "iris/sqlflow/my_dnn_model" |
| 150 | scriptPath := "file:///tmp/task.tar.gz" |
| 151 | paramsPath := "file:///tmp/params.txt" |
| 152 | paiTFCode, paiCmd, _, e := Predict(ir, sess, scriptPath, paramsPath, "my_dnn_model", ossModelPath, "", model.TENSORFLOW) |
| 153 | a.NoError(e) |
| 154 | a.False(hasUnknownParameters(paiTFCode, knownPredictParams)) |
| 155 | tfCode, err := tensorflow.Pred(ir, sess) |
| 156 | a.NoError(err) |
| 157 | |
| 158 | a.True(hasExportedLocal(tfCode)) |
| 159 | a.False(hasUnknownParameters(tfCode, knownPredictParams)) |
| 160 | expectedPAICmd := fmt.Sprintf("pai -name tensorflow1150 -project algo_public_dev -DmaxHungTimeBeforeGCInSeconds=0 -DjobName=sqlflow_my_dnn_model -Dtags=dnn -Dscript=%s -DentryFile=entry.py -Dtables=odps://iris/tables/predict -Doutputs=odps://iris/tables/predict -DhyperParameters=\"%s\" -DcheckpointDir='oss://sqlflow-models/iris/sqlflow/my_dnn_model/?role_arn=acs:ram::9527:role/pai2ossproject&host=h.com' -DgpuRequired='0'", scriptPath, paramsPath) |
| 161 | a.Equal(expectedPAICmd, paiCmd) |
| 162 | } |
nothing calls this directly
no test coverage detected