Commit 5eed3585 authored by 王宦普's avatar 王宦普

whp:dev_GPU

parent 95136c08
...@@ -23,7 +23,7 @@ public class AnalysisDataUtil { ...@@ -23,7 +23,7 @@ public class AnalysisDataUtil {
// 构建 ProcessBuilder // 构建 ProcessBuilder
ProcessBuilder pb = new ProcessBuilder( ProcessBuilder pb = new ProcessBuilder(
"/opt/conda/envs/py310gdal/bin/python", "/opt/conda/envs/py_torch/bin/python",
"-u", "-u",
pythonPath, pythonPath,
"-i", "-i",
...@@ -32,8 +32,8 @@ public class AnalysisDataUtil { ...@@ -32,8 +32,8 @@ public class AnalysisDataUtil {
// 配置环境变量 // 配置环境变量
Map<String, String> env = pb.environment(); Map<String, String> env = pb.environment();
env.put("GDAL_DATA", "/opt/conda/envs/py310gdal/share/gdal"); env.put("GDAL_DATA", "/opt/conda/envs/py_torch/share/gdal");
env.put("PROJ_LIB", "/opt/conda/envs/py310gdal/share/proj"); env.put("PROJ_LIB", "/opt/conda/envs/py_torch/share/proj");
// 确保 gdal_translate 等命令可用 // 确保 gdal_translate 等命令可用
String oldPath = env.getOrDefault("PATH", ""); String oldPath = env.getOrDefault("PATH", "");
env.put("PATH", "/opt/conda/envs/py310gdal/bin:" + oldPath); env.put("PATH", "/opt/conda/envs/py310gdal/bin:" + oldPath);
......
package com.jianju.hunanconsumer; package com.jianju.hunanconsumer;
import com.alibaba.fastjson.JSONObject;
import com.jianju.hunanconsumer.util.ApiRequest;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.web.client.RestTemplate;
import java.util.HashMap;
import java.util.Map;
@SpringBootTest @SpringBootTest
class HunanConsumerApplicationTests { class HunanConsumerApplicationTests {
@Autowired
private RestTemplate restTemplate;
@Test @Test
void contextLoads() { void contextLoads() {
String url = "http://localhost:8080/api/AcceptMessage";
Map<String,Object> map = new HashMap<>();
Map<String,Object> param = new HashMap<>();
map.put("serviceName","python_docker");
map.put("taskName","run_pyflextrkr");
param.put("input_file", "/home/jiajukeji/space2/hunan_geohazard/test_GF1/GF1_WFV2_E113.5_N29.3_20250615_L1A13921154001/GF1_WFV2_E113.5_N29.3_20250615_L1A13921154001.tiff");
map.put("inputParameters",param);
map.put("pythonType","LIM");
JSONObject jsonObject = new JSONObject(map);
ApiRequest.Send(url,jsonObject, restTemplate);
} }
/**
* "serviceName": "python_docker",
* "taskName": "run_pyflextrkr",
* "inputParameters": {
* "input_file": "/home/jiajukeji/space2/hunan_geohazard/test_GF1/GF1_WFV2_E113.5_N29.3_20250615_L1A13921154001/GF1_WFV2_E113.5_N29.3_20250615_L1A13921154001.tiff"
* },
* "pythonType": "LIM"
*/
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment