Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
OpenXG-WIC-Cnf
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
3
Issues
3
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
CommunityXG
OpenXG-WIC-Cnf
Commits
ad5cb34d
Commit
ad5cb34d
authored
Sep 05, 2020
by
ymwang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
中间结果存储
parent
e16ebe33
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
38 additions
and
18 deletions
+38
-18
apps/cnf-distributed-business-computing/dbc-business-client/src/main/java/top/ninwoo/dbc/client/service/FileService.java
.../main/java/top/ninwoo/dbc/client/service/FileService.java
+20
-12
apps/cnf-distributed-business-computing/dbc-business-server/src/main/java/top/ninwoo/dbc/server/serviceimpl/FileServiceImpl.java
...va/top/ninwoo/dbc/server/serviceimpl/FileServiceImpl.java
+3
-3
apps/cnf-distributed-business-computing/dbc-businessComputing-topology/src/test/java/top/ninwoo/tests/TopoTests.java
...ng-topology/src/test/java/top/ninwoo/tests/TopoTests.java
+15
-3
No files found.
apps/cnf-distributed-business-computing/dbc-business-client/src/main/java/top/ninwoo/dbc/client/service/FileService.java
View file @
ad5cb34d
...
...
@@ -41,23 +41,22 @@ public class FileService{
@Autowired
private
DistributedComService
distributedComService
;
private
String
[]
ipList
=
null
;
Long
clusterId
=
11113L
;
//docker集群ID
String
[]
wxName_list
=
new
String
[]{
"sate2"
,
"sate3"
,
"sate4"
,
"sate5"
,
"sate6"
,
"sate7"
,
"sate8"
,
"sate9"
,
"sate10"
,
"sate11"
,
String
[]
wxName_list
=
new
String
[]{
"sate
1"
,
"sate
2"
,
"sate3"
,
"sate4"
,
"sate5"
,
"sate6"
,
"sate7"
,
"sate8"
,
"sate9"
,
"sate10"
,
"sate11"
,
"sate12"
,
"sate13"
,
"sate14"
,
"sate15"
,
"sate16"
,
"sate17"
,
"sate18"
,
"sate19"
,
"sate20"
,
"sate21"
,
"sate22"
,
"sate23"
,
"sate24"
,
"sate25"
,
"sate26"
,
"sate27"
,
"sate28"
,
"sate29"
,
"sate30"
};
//获取卫星名字
"sate22"
,
"sate23"
,
"sate24"
,
"sate25"
,
"sate26"
,
"sate27"
,
"sate28"
,
"sate29"
};
//获取卫星名字
@PostConstruct
private
String
[]
ipList
=
new
String
[
29
];
/* @PostConstruct
public void init() {
/* ipList = getIpList(11113l,"dbc_server");
System.out.println(Arrays.toString(ipList));*/
*/
/* ipList = getIpList(11113l,"dbc_server");
System.out.println(Arrays.toString(ipList));*/
/*
for (int k = 0; k < wxName_list.length; k++){
ipList
=
getIpList
(
clusterId
,
wxName_list
[
k
]);
//通过卫星名字获取卫星ip
ipList
[k]
= getIpList(clusterId,wxName_list[k]);//通过卫星名字获取卫星ip
}
}
*/
/*获取容器ip*/
/* String[] ipList = new String[]{"127.0.0.1:8080","127.0.0.1:8081","127.0.0.1:8082","127.0.0.1:8083","127.0.0.1:8084",
"127.0.0.1:8085","127.0.0.1:8086"};*/
...
...
@@ -75,6 +74,15 @@ public class FileService{
return
containerIp
;
}
public
String
getIpByAppName
(
Long
clusterId
,
String
appName
)
{
List
<
String
>
ipList
=
networkService
.
getIpListByAppName
(
clusterId
,
appName
);
if
(!
ipList
.
isEmpty
()){
String
ip_tmp
=
ipList
.
get
(
0
);
String
[]
split_list
=
ip_tmp
.
split
(
"/"
);
return
split_list
[
0
]
+
":8082"
;
}
return
null
;
}
/**
* 发送文件到分布式节点
...
...
@@ -89,7 +97,7 @@ public class FileService{
//ipList = getIpList(11113l,"dbc_server");
for
(
int
i
=
0
;
i
<
wxName_list
.
length
;
i
++){
ipList
=
getIpList
(
clusterId
,
wxName_list
[
i
]);
//通过卫星名字获取卫星ip
ipList
[
i
]
=
getIpByAppName
(
clusterId
,
wxName_list
[
i
]);
//通过卫星名字获取卫星ip
}
//查看ip
System
.
out
.
println
(
ipList
.
length
);
...
...
@@ -107,7 +115,7 @@ public class FileService{
try
{
sendFileSlice
(
ipList
[
ipIndex
],
slice
);
//
System
.
out
.
println
(
"send "
+
ipList
[
ipIndex
]+
"sucess"
);
System
.
out
.
println
(
"send "
+
ipList
[
ipIndex
]+
"suc
c
ess"
);
ipIndex
=
(
ipIndex
+
1
)
%
ipList
.
length
;
break
;
}
catch
(
Exception
e
){
...
...
@@ -150,7 +158,7 @@ public class FileService{
public
String
getFile
(
String
fileName
,
Long
fileId
)
{
//ipList = getIpList(11113l,"dbc_server");
for
(
int
i
=
0
;
i
<
wxName_list
.
length
;
i
++){
ipList
=
getIpList
(
clusterId
,
wxName_list
[
i
]);
//通过卫星名字获取卫星ip
ipList
[
i
]
=
getIpByAppName
(
clusterId
,
wxName_list
[
i
]);
//通过卫星名字获取卫星ip
}
int
sliceNum
=
ipList
.
length
;
//int sliceNum = ipList.length;
...
...
apps/cnf-distributed-business-computing/dbc-business-server/src/main/java/top/ninwoo/dbc/server/serviceimpl/FileServiceImpl.java
View file @
ad5cb34d
...
...
@@ -14,8 +14,8 @@ import java.io.IOException;
@Service
public
class
FileServiceImpl
implements
FileService
{
@Value
(
"${dbc.directory.output}"
)
private
String
directoryOutput
;
/*
@Value("${dbc.directory.output}")
private String directoryOutput;
*/
//分散计算
@Override
...
...
@@ -59,7 +59,7 @@ public class FileServiceImpl implements FileService {
}
}
//这里需提供新的文件输出
ImageIO
.
write
(
grayImage
,
"jpg"
,
new
File
(
directoryOutput
+
"out
"
));
ImageIO
.
write
(
grayImage
,
"jpg"
,
new
File
(
"/tmp/static/out.jpg
"
));
System
.
out
.
println
(
"download sucess"
);
return
true
;
}
...
...
apps/cnf-distributed-business-computing/dbc-businessComputing-topology/src/test/java/top/ninwoo/tests/TopoTests.java
View file @
ad5cb34d
...
...
@@ -54,7 +54,7 @@ public class TopoTests {
//创建容器
ContainerDescription
containerDescription0
=
new
ContainerDescription
();
/*
ContainerDescription containerDescription0 = new ContainerDescription();
containerDescription0.setMode("normal");
containerDescription0.setReplicas(1);
...
...
@@ -65,8 +65,8 @@ public class TopoTests {
container0.setPorts("8999");//指定容器端口
containerDescription0.setDockerContainer(container0);
cds
.
add
(
containerDescription0
);
for
(
int
k
=
1
;
k
<
wxData
.
size
()
;
k
++)
{
cds.add(containerDescription0);
*/
for
(
int
k
=
0
;
k
<
wxData
.
size
()-
1
;
k
++)
{
ContainerDescription
containerDescription
=
new
ContainerDescription
();
containerDescription
.
setMode
(
"normal"
);
containerDescription
.
setReplicas
(
1
);
...
...
@@ -79,7 +79,19 @@ public class TopoTests {
containerDescription
.
setDockerContainer
(
container
);
cds
.
add
(
containerDescription
);
}
ContainerDescription
containerDescription0
=
new
ContainerDescription
();
containerDescription0
.
setMode
(
"normal"
);
containerDescription0
.
setReplicas
(
1
);
DockerContainer
container0
=
new
DockerContainer
();
container0
.
setName
(
wxData
.
get
(
wxData
.
size
()-
1
).
getName
());
container0
.
setCommand
(
"sh"
);
container0
.
setImage
(
"dbc_client"
);
container0
.
setPorts
(
"8999"
);
//指定容器端口
containerDescription0
.
setDockerContainer
(
container0
);
cds
.
add
(
containerDescription0
);
/////////////////////////////////////////////
clusterConfig
.
setDockers
(
cds
);
NetworkTopology
topo
=
new
NetworkTopology
();
topo
.
setAppNames
(
tp
.
getAppNames
(
wxData
));
...
...
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