Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
H
hunanPythonModel
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
王宦普
hunanPythonModel
Commits
5eed3585
Commit
5eed3585
authored
Sep 18, 2025
by
王宦普
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
whp:dev_GPU
parent
95136c08
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
31 additions
and
4 deletions
+31
-4
AnalysisDataUtil.java
.../java/com/jianju/hunanconsumer/util/AnalysisDataUtil.java
+3
-3
HunanConsumerApplicationTests.java
...m/jianju/hunanconsumer/HunanConsumerApplicationTests.java
+28
-1
No files found.
src/main/java/com/jianju/hunanconsumer/util/AnalysisDataUtil.java
View file @
5eed3585
...
@@ -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/py
310gdal
/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/py
310gdal
/share/gdal"
);
env
.
put
(
"GDAL_DATA"
,
"/opt/conda/envs/py
_torch
/share/gdal"
);
env
.
put
(
"PROJ_LIB"
,
"/opt/conda/envs/py
310gdal
/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
);
...
...
src/test/java/com/jianju/hunanconsumer/HunanConsumerApplicationTests.java
View file @
5eed3585
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"
*/
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment