Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
Distributed Computing and Network Fusion System
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
WirelessInformationCollaborate
Distributed Computing and Network Fusion System
Commits
ad5cb34d
Commit
ad5cb34d
authored
Sep 05, 2020
by
ymwang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
中间结果存储
parent
e16ebe33
Changes
3
Hide 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{
...
@@ -41,23 +41,22 @@ public class FileService{
@Autowired
@Autowired
private
DistributedComService
distributedComService
;
private
DistributedComService
distributedComService
;
private
String
[]
ipList
=
null
;
Long
clusterId
=
11113L
;
//docker集群ID
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"
,
"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() {
public void init() {
/* ipList = getIpList(11113l,"dbc_server");
*/
/* ipList = getIpList(11113l,"dbc_server");
System.out.println(Arrays.toString(ipList));*/
System.out.println(Arrays.toString(ipList));*/
/*
for (int k = 0; k < wxName_list.length; k++){
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*/
/*获取容器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",
/* 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"};*/
"127.0.0.1:8085","127.0.0.1:8086"};*/
...
@@ -75,6 +74,15 @@ public class FileService{
...
@@ -75,6 +74,15 @@ public class FileService{
return
containerIp
;
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{
...
@@ -89,7 +97,7 @@ public class FileService{
//ipList = getIpList(11113l,"dbc_server");
//ipList = getIpList(11113l,"dbc_server");
for
(
int
i
=
0
;
i
<
wxName_list
.
length
;
i
++){
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
//查看ip
System
.
out
.
println
(
ipList
.
length
);
System
.
out
.
println
(
ipList
.
length
);
...
@@ -107,7 +115,7 @@ public class FileService{
...
@@ -107,7 +115,7 @@ public class FileService{
try
{
try
{
sendFileSlice
(
ipList
[
ipIndex
],
slice
);
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
;
ipIndex
=
(
ipIndex
+
1
)
%
ipList
.
length
;
break
;
break
;
}
catch
(
Exception
e
){
}
catch
(
Exception
e
){
...
@@ -150,7 +158,7 @@ public class FileService{
...
@@ -150,7 +158,7 @@ public class FileService{
public
String
getFile
(
String
fileName
,
Long
fileId
)
{
public
String
getFile
(
String
fileName
,
Long
fileId
)
{
//ipList = getIpList(11113l,"dbc_server");
//ipList = getIpList(11113l,"dbc_server");
for
(
int
i
=
0
;
i
<
wxName_list
.
length
;
i
++){
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
;
//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;
...
@@ -14,8 +14,8 @@ import java.io.IOException;
@Service
@Service
public
class
FileServiceImpl
implements
FileService
{
public
class
FileServiceImpl
implements
FileService
{
@Value
(
"${dbc.directory.output}"
)
/*
@Value("${dbc.directory.output}")
private
String
directoryOutput
;
private String directoryOutput;
*/
//分散计算
//分散计算
@Override
@Override
...
@@ -59,7 +59,7 @@ public class FileServiceImpl implements FileService {
...
@@ -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"
);
System
.
out
.
println
(
"download sucess"
);
return
true
;
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 {
...
@@ -54,7 +54,7 @@ public class TopoTests {
//创建容器
//创建容器
ContainerDescription
containerDescription0
=
new
ContainerDescription
();
/*
ContainerDescription containerDescription0 = new ContainerDescription();
containerDescription0.setMode("normal");
containerDescription0.setMode("normal");
containerDescription0.setReplicas(1);
containerDescription0.setReplicas(1);
...
@@ -65,8 +65,8 @@ public class TopoTests {
...
@@ -65,8 +65,8 @@ public class TopoTests {
container0.setPorts("8999");//指定容器端口
container0.setPorts("8999");//指定容器端口
containerDescription0.setDockerContainer(container0);
containerDescription0.setDockerContainer(container0);
cds
.
add
(
containerDescription0
);
cds.add(containerDescription0);
*/
for
(
int
k
=
1
;
k
<
wxData
.
size
()
;
k
++)
{
for
(
int
k
=
0
;
k
<
wxData
.
size
()-
1
;
k
++)
{
ContainerDescription
containerDescription
=
new
ContainerDescription
();
ContainerDescription
containerDescription
=
new
ContainerDescription
();
containerDescription
.
setMode
(
"normal"
);
containerDescription
.
setMode
(
"normal"
);
containerDescription
.
setReplicas
(
1
);
containerDescription
.
setReplicas
(
1
);
...
@@ -79,7 +79,19 @@ public class TopoTests {
...
@@ -79,7 +79,19 @@ public class TopoTests {
containerDescription
.
setDockerContainer
(
container
);
containerDescription
.
setDockerContainer
(
container
);
cds
.
add
(
containerDescription
);
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
);
clusterConfig
.
setDockers
(
cds
);
NetworkTopology
topo
=
new
NetworkTopology
();
NetworkTopology
topo
=
new
NetworkTopology
();
topo
.
setAppNames
(
tp
.
getAppNames
(
wxData
));
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