|
|
@@ -27,6 +27,7 @@ import org.springframework.web.multipart.MultipartFile; |
|
|
import javax.annotation.Resource; |
|
|
import javax.annotation.Resource; |
|
|
import java.io.File; |
|
|
import java.io.File; |
|
|
import java.io.IOException; |
|
|
import java.io.IOException; |
|
|
|
|
|
import java.util.ArrayList; |
|
|
import java.util.HashMap; |
|
|
import java.util.HashMap; |
|
|
import java.util.List; |
|
|
import java.util.List; |
|
|
import java.util.Map; |
|
|
import java.util.Map; |
|
|
@@ -43,6 +44,9 @@ public class AutoMlServiceImpl implements AutoMlService { |
|
|
@Value("${argo.workflowRun}") |
|
|
@Value("${argo.workflowRun}") |
|
|
private String argoWorkflowRun; |
|
|
private String argoWorkflowRun; |
|
|
|
|
|
|
|
|
|
|
|
@Value("${minio.endpoint}") |
|
|
|
|
|
private String minioEndpoint; |
|
|
|
|
|
|
|
|
@Resource |
|
|
@Resource |
|
|
private AutoMlDao autoMlDao; |
|
|
private AutoMlDao autoMlDao; |
|
|
|
|
|
|
|
|
@@ -81,8 +85,7 @@ public class AutoMlServiceImpl implements AutoMlService { |
|
|
} |
|
|
} |
|
|
AutoMl autoMl = new AutoMl(); |
|
|
AutoMl autoMl = new AutoMl(); |
|
|
BeanUtils.copyProperties(autoMlVo, autoMl); |
|
|
BeanUtils.copyProperties(autoMlVo, autoMl); |
|
|
// String username = SecurityUtils.getLoginUser().getUsername(); |
|
|
|
|
|
String username = "admin"; |
|
|
|
|
|
|
|
|
String username = SecurityUtils.getLoginUser().getUsername(); |
|
|
autoMl.setUpdateBy(username); |
|
|
autoMl.setUpdateBy(username); |
|
|
String datasetJson = JacksonUtil.toJSONString(autoMlVo.getDataset()); |
|
|
String datasetJson = JacksonUtil.toJSONString(autoMlVo.getDataset()); |
|
|
autoMl.setDataset(datasetJson); |
|
|
autoMl.setDataset(datasetJson); |
|
|
@@ -123,8 +126,7 @@ public class AutoMlServiceImpl implements AutoMlService { |
|
|
public Map<String, String> upload(MultipartFile file, String uuid) throws Exception { |
|
|
public Map<String, String> upload(MultipartFile file, String uuid) throws Exception { |
|
|
Map<String, String> result = new HashMap<>(); |
|
|
Map<String, String> result = new HashMap<>(); |
|
|
|
|
|
|
|
|
// String username = SecurityUtils.getLoginUser().getUsername(); |
|
|
|
|
|
String username = "admin"; |
|
|
|
|
|
|
|
|
String username = SecurityUtils.getLoginUser().getUsername(); |
|
|
String fileName = file.getOriginalFilename(); |
|
|
String fileName = file.getOriginalFilename(); |
|
|
String path = localPath + "temp/" + username + "/automl_data/" + uuid; |
|
|
String path = localPath + "temp/" + username + "/automl_data/" + uuid; |
|
|
long sizeInBytes = file.getSize(); |
|
|
long sizeInBytes = file.getSize(); |
|
|
@@ -186,6 +188,18 @@ public class AutoMlServiceImpl implements AutoMlService { |
|
|
//替换argoInsName |
|
|
//替换argoInsName |
|
|
String outputString = JsonUtils.mapToJson(output); |
|
|
String outputString = JsonUtils.mapToJson(output); |
|
|
autoMlIns.setNodeResult(outputString.replace("{{workflow.name}}", (String) metadata.get("name"))); |
|
|
autoMlIns.setNodeResult(outputString.replace("{{workflow.name}}", (String) metadata.get("name"))); |
|
|
|
|
|
|
|
|
|
|
|
Map<String, Object> param_output = (Map<String, Object>) output.get("param_output"); |
|
|
|
|
|
List output1 = (ArrayList) param_output.values().toArray()[0]; |
|
|
|
|
|
Map<String, String> output2 = (Map<String, String>) output1.get(0); |
|
|
|
|
|
String outputPath = minioEndpoint + "/" + output2.get("path").replace("{{workflow.name}}", (String) metadata.get("name")) + "/"; |
|
|
|
|
|
autoMlIns.setModelPath(outputPath + "save_model.joblib"); |
|
|
|
|
|
if (Constant.AutoMl_Classification.equals(autoMl.getTaskType())) { |
|
|
|
|
|
autoMlIns.setImgPath(outputPath + "Auto-sklearn_accuracy_over_time.png" + "," + outputPath + "Train_Confusion_Matrix.png" + "," + outputPath + "Test_Confusion_Matrix.png"); |
|
|
|
|
|
} else { |
|
|
|
|
|
autoMlIns.setImgPath(outputPath + "Auto-sklearn_accuracy_over_time.png" + "," + outputPath + "regression.png"); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
autoMlInsDao.insert(autoMlIns); |
|
|
autoMlInsDao.insert(autoMlIns); |
|
|
|
|
|
|
|
|
} catch (Exception e) { |
|
|
} catch (Exception e) { |
|
|
|