Compare commits

..

No commits in common. "8edd0cdb163f7e3e85d06987ba55130b986586cb" and "a4071114fc0ef2d358739abb72891eaa69ce3abc" have entirely different histories.

3 changed files with 5 additions and 10 deletions

View File

@ -9,11 +9,6 @@ import org.springframework.stereotype.Component;
@ConfigurationProperties(prefix = "t1h-download") @ConfigurationProperties(prefix = "t1h-download")
public class T1hDownloadProperties { public class T1hDownloadProperties {
/**
* python环境路径
*/
private String pythonPath;
/** /**
* 下载T1H的Py脚本路径 * 下载T1H的Py脚本路径
*/ */

View File

@ -24,8 +24,7 @@ public class ExecutePyUtils {
processWatch.start(); processWatch.start();
Process process = null; Process process = null;
try { try {
System.out.println("执行命令: " + String.join(" ", processBuilder.command()));
System.out.println("工作目录: " + processBuilder.directory());
process = processBuilder.start(); process = processBuilder.start();
// 异步处理输出流 // 异步处理输出流

View File

@ -86,7 +86,7 @@ public class DownloadT1hJob {
List<String> forecastTimes = generateForecastTimes(); List<String> forecastTimes = generateForecastTimes();
ProcessBuilder processBuilder = new ProcessBuilder( ProcessBuilder processBuilder = new ProcessBuilder(
t1hDownloadProperties.getPythonPath(), systemStorageProperties.getAiModelsPath() + File.separator + "python3 ",
getPythonScriptPath(t1hDownloadProperties.getMergeT1hPy()), getPythonScriptPath(t1hDownloadProperties.getMergeT1hPy()),
"--indir", getFullPath(t1hDownloadProperties.getT1hPath(), baseTime), "--indir", getFullPath(t1hDownloadProperties.getT1hPath(), baseTime),
"--output_dir", getFullPath(systemStorageProperties.getT1h(), baseTime), "--output_dir", getFullPath(systemStorageProperties.getT1h(), baseTime),
@ -94,7 +94,7 @@ public class DownloadT1hJob {
"--forecast_times", String.join(",", forecastTimes), "--forecast_times", String.join(",", forecastTimes),
"--base_date", baseTime "--base_date", baseTime
); );
processBuilder.directory(new File(systemStorageProperties.getRootPath()));
ExecutePyUtils.executePythonProcess(processBuilder, "文件合并"); ExecutePyUtils.executePythonProcess(processBuilder, "文件合并");
} }
@ -127,6 +127,7 @@ public class DownloadT1hJob {
log.info("执行Python脚本: {}", Arrays.toString(command)); log.info("执行Python脚本: {}", Arrays.toString(command));
ProcessBuilder processBuilder = new ProcessBuilder(command); ProcessBuilder processBuilder = new ProcessBuilder(command);
processBuilder.directory(new File(systemStorageProperties.getRootPath()));
ExecutePyUtils.executePythonProcess(processBuilder, ExecutePyUtils.executePythonProcess(processBuilder,
String.format("元素%s预报时长%s下载", element, forecastHours)); String.format("元素%s预报时长%s下载", element, forecastHours));
} }
@ -136,7 +137,7 @@ public class DownloadT1hJob {
*/ */
private String[] buildPythonCommand(String element, String baseTime, String forecastHours) { private String[] buildPythonCommand(String element, String baseTime, String forecastHours) {
return new String[]{ return new String[]{
t1hDownloadProperties.getPythonPath(), systemStorageProperties.getAiModelsPath() + File.separator + "python3 ",
getPythonScriptPath(t1hDownloadProperties.getDownloadT1hPy()), getPythonScriptPath(t1hDownloadProperties.getDownloadT1hPy()),
"--base-time", baseTime, "--base-time", baseTime,
"--element", element, "--element", element,