线上wrf-cmaq完成调试
This commit is contained in:
parent
aca2e0983c
commit
a022fc1d9a
|
|
@ -151,31 +151,27 @@ public class BaseAPIServiceImpl implements BaseAPIService {
|
|||
return (lat >= minLat && lat <= maxLat && lon >= minLon && lon <= maxLon);
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public String buildEngineeringFilePath(String modelPath, String createBy, String engineeringName) {
|
||||
// return eventServerProperties.getBaseHome() +
|
||||
// File.separator +
|
||||
// modelPath +
|
||||
// File.separator +
|
||||
// createBy +
|
||||
// File.separator +
|
||||
// engineeringName +
|
||||
// File.separator;
|
||||
// }
|
||||
|
||||
@Override
|
||||
public String buildEngineeringFilePath(String modelPath, String createBy, String engineeringName) {
|
||||
return eventServerProperties.getBaseHome() +
|
||||
// File.separator +
|
||||
"/" +
|
||||
File.separator +
|
||||
modelPath +
|
||||
// File.separator +
|
||||
"/" +
|
||||
File.separator +
|
||||
createBy +
|
||||
// File.separator +
|
||||
"/" +
|
||||
File.separator +
|
||||
engineeringName +
|
||||
"/";
|
||||
// File.separator;
|
||||
File.separator;
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public String buildEngineeringFilePath(String modelPath, String createBy, String engineeringName) {
|
||||
// return eventServerProperties.getBaseHome() +
|
||||
// "/" +
|
||||
// modelPath +
|
||||
// "/" +
|
||||
// createBy +
|
||||
// "/" +
|
||||
// engineeringName +
|
||||
// "/";
|
||||
// }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -133,7 +133,7 @@ public class CmaqServiceImpl extends ServiceImpl<CmaqMapper, Cmaq> implements Cm
|
|||
|
||||
public Result<String> genMcipTxtFile(String mcipPath, String emisPath, Cmaq cmaq, String sDate, Double lon, Double lat) {
|
||||
try {
|
||||
List<String> gridDescFileValue = Files.readAllLines(get("E:\\wm\\resultFile\\" + "GRIDDESC.d03"));
|
||||
List<String> gridDescFileValue = Files.readAllLines(get(mcipPath + "GRIDDESC.d03"));
|
||||
List<String> fileValues = Arrays.stream(gridDescFileValue.get(5).split(" ")).filter(s -> StringUtils.isNotBlank(s)).collect(Collectors.toList());
|
||||
|
||||
List<String> domainValues = new ArrayList<>();
|
||||
|
|
@ -172,8 +172,7 @@ public class CmaqServiceImpl extends ServiceImpl<CmaqMapper, Cmaq> implements Cm
|
|||
public boolean getFileExists(String filePath){
|
||||
String cmdResult = RemoteExecuteCommand.runRemoteLinuxCmd(eventServerProperties.getIp(), eventServerProperties.getUsername(), eventServerProperties.getPassword(),
|
||||
"ls " + filePath);
|
||||
boolean succesfully = cmdResult.indexOf("没有那个文件或目录") < 0;
|
||||
return succesfully;
|
||||
return !cmdResult.contains("没有那个文件或目录") || !cmdResult.contains("No such file or directory");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -64,8 +64,8 @@ public class EngineeringServiceImpl extends ServiceImpl<EngineeringMapper, Engin
|
|||
|
||||
@Override
|
||||
public void initDir(Engineering engineering){
|
||||
// String baseHome = eventServerProperties.getBaseHome() + File.separator;
|
||||
String baseHome = eventServerProperties.getBaseHome() + "/";
|
||||
String baseHome = eventServerProperties.getBaseHome() + File.separator;
|
||||
// String baseHome = eventServerProperties.getBaseHome() + "/";
|
||||
String ip = eventServerProperties.getIp();
|
||||
String username = eventServerProperties.getUsername();
|
||||
String password = eventServerProperties.getPassword();
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ public class RunProcessController {
|
|||
bizEngineering.setEventType(paramVO.getEventType());
|
||||
bizEngineering.setEnginStatus(2);
|
||||
engineeringService.updateById(bizEngineering);
|
||||
// engineeringService.initDir(bizEngineering);
|
||||
engineeringService.initDir(bizEngineering);
|
||||
wrfService.updateWrfInfo(paramVO);
|
||||
cmaqService.updateCmaqInfo(paramVO);
|
||||
runProcessService.runAllExe(paramVO);
|
||||
|
|
|
|||
|
|
@ -17,6 +17,6 @@ public interface WrfService extends IService<Wrf> {
|
|||
|
||||
Result<String> updateWrfInfo(RunProcessParamVO paramVO);
|
||||
String genWpsShell(String scriptsPath, String fileName, Wrf wrf) throws IOException;
|
||||
Result<String> runAllWrf(String engId, String scriptsPath, String resultFilePath) throws IOException;
|
||||
Result<String> runAllWrf(String engId, String scriptsPath, String workDirPath) throws IOException;
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -115,9 +115,9 @@ public class WrfServiceImpl extends ServiceImpl<WrfMapper, Wrf> implements WrfSe
|
|||
}
|
||||
|
||||
@Override
|
||||
public Result<String> runAllWrf(String engId, String scriptsPath, String resultFilePath) throws IOException {
|
||||
public Result<String> runAllWrf(String engId, String scriptsPath, String workDirPath) throws IOException {
|
||||
String cdShRunPath = "cd " + scriptsPath + ";";
|
||||
boolean wpsSuccess = runProjectWps(cdShRunPath + "source ~/.bash_profile;chmod +x run_project_wps.sh;./run_project_wps.sh", resultFilePath);
|
||||
boolean wpsSuccess = runProjectWps(cdShRunPath + "source ~/.bash_profile;chmod +x run_project_wps.sh;./run_project_wps.sh", workDirPath);
|
||||
if (!wpsSuccess){
|
||||
return Result.error("WPS模块运行异常,请查看日志信息!");
|
||||
}
|
||||
|
|
@ -125,25 +125,25 @@ public class WrfServiceImpl extends ServiceImpl<WrfMapper, Wrf> implements WrfSe
|
|||
RemoteExecuteCommand.runRemoteLinuxCmd(eventServerProperties.getIp(), eventServerProperties.getUsername(), eventServerProperties.getPassword(),
|
||||
runPyPath(scriptsPath, "update_num_metgrid_levels.py", null));
|
||||
|
||||
boolean wrfSuccess = runProjectWrf(cdShRunPath + "source ~/.bash_profile;chmod +x run_project_wrf.sh;./run_project_wrf.sh", resultFilePath);
|
||||
boolean wrfSuccess = runProjectWrf(cdShRunPath + "source ~/.bash_profile;chmod +x run_project_wrf.sh;./run_project_wrf.sh", workDirPath);
|
||||
if (!wrfSuccess){
|
||||
return Result.error("WRF模块运行异常,请查看日志信息!");
|
||||
}
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
public boolean runProjectWps(String cmdString,String resultFilePath) throws IOException {
|
||||
public boolean runProjectWps(String cmdString,String workDirPath) throws IOException {
|
||||
RemoteExecuteCommand.runRemoteLinuxCmd(eventServerProperties.getIp(), eventServerProperties.getUsername(), eventServerProperties.getPassword(), cmdString);
|
||||
String metgridLog = new String(readAllBytes(get(resultFilePath + EventConstants.WRF_DIR+ "/metgrid.log")));
|
||||
String metgridLog = new String(readAllBytes(get(workDirPath + EventConstants.WRF_DIR+ "/metgrid.log")));
|
||||
if(metgridLog.indexOf("Successful completion of program metgrid.exe") > 0){
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean runProjectWrf(String cmdString,String resultFilePath) throws IOException {
|
||||
public boolean runProjectWrf(String cmdString,String workDirPath) throws IOException {
|
||||
RemoteExecuteCommand.runRemoteLinuxCmd(eventServerProperties.getIp(), eventServerProperties.getUsername(), eventServerProperties.getPassword(), cmdString);
|
||||
String wrfLog = new String(readAllBytes(get(resultFilePath + EventConstants.WRF_DIR + "/rsl.out.0000")));
|
||||
String wrfLog = new String(readAllBytes(get(workDirPath + EventConstants.WRF_DIR + "/rsl.out.0000")));
|
||||
if(wrfLog.indexOf("SUCCESS COMPLETE WRF") > 0){
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user