Skip to content

Commit

Permalink
add assembly
Browse files Browse the repository at this point in the history
  • Loading branch information
Litchilitchy authored and Hanyu-Jin committed Aug 15, 2022
1 parent 78e2980 commit 82192a7
Show file tree
Hide file tree
Showing 7 changed files with 104 additions and 2 deletions.
9 changes: 9 additions & 0 deletions python/ppml/scripts/ppml-conf.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
##### Server property
# clientNum: 2
# privateKeyFilePath: /ppml/trusted-big-data-ml/work/keys/server.pem
# certChainFilePath: /ppml/trusted-big-data-ml/work/keys/server.crt
# serverPort:

##### Client property
# clientTarget:
# taskID:
5 changes: 5 additions & 0 deletions python/ppml/scripts/setup-env.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
PYTHON_ZIP=$(find lib -name *-python-api.zip)
JAR=$(find lib -name *-jar-with-dependencies.jar)
export PYTHONPATH=$PYTHONPATH:$(pwd)/$PYTHON_ZIP
export PYTHONPATH=$PYTHONPATH:$(pwd)/$PYTHON_ZIP/bigdl/ppml/fl/nn/generated
export BIGDL_CLASSPATH=$JAR
23 changes: 23 additions & 0 deletions python/ppml/scripts/start-fgboost-server.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#
# Copyright 2016 The BigDL Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

from bigdl.ppml.fl.fl_server import FLServer

if __name__ == '__main__':
fl_server = FLServer()
fl_server.build()
fl_server.start()
fl_server.wait_for_termination()
23 changes: 23 additions & 0 deletions python/ppml/scripts/start-fl-server.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#
# Copyright 2016 The BigDL Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

from bigdl.ppml.fl.nn.fl_server import FLServer

if __name__ == '__main__':
fl_server = FLServer()
fl_server.build()
fl_server.start()
fl_server.wait_for_termination()
6 changes: 4 additions & 2 deletions python/ppml/src/bigdl/ppml/fl/nn/fl_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@
from bigdl.ppml.fl.nn.generated.nn_service_pb2_grpc import *
from bigdl.ppml.fl.nn.nn_service import NNServiceImpl
import yaml

import logging


class FLServer(object):
def __init__(self, client_num=1):
self.server = grpc.server(futures.ThreadPoolExecutor(max_workers=5))
self.port = 8980 # TODO: set from config file
self.port = 8980
self.client_num = client_num
self.secure = False
self.load_config()
Expand Down Expand Up @@ -65,6 +65,8 @@ def load_config(self):
( (private_key, certificate_chain), ) )
if 'serverPort' in conf:
self.port = conf['serverPort']
if 'clientNum' in conf:
self.client_num = conf['clientNum']

except yaml.YAMLError as e:
logging.warn('Loading config failed, using default config ')
Expand Down
14 changes: 14 additions & 0 deletions scala/ppml/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -414,6 +414,20 @@
<goal>single</goal>
</goals>
</execution>
<execution>
<id>assembly</id>
<inherited>false</inherited>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<descriptors>
<descriptor>${project.basedir}/src/assembly/ppml-assembly.xml
</descriptor>
</descriptors>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
Expand Down
26 changes: 26 additions & 0 deletions scala/ppml/src/assembly/ppml-assembly.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<assembly xmlns="http://maven.apache.org/ASSEMBLY/2.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/ASSEMBLY/2.0.0 http://maven.apache.org/xsd/assembly-2.0.0.xsd">
<id>ppml-assembly</id>
<formats>
<format>dir</format>
<format>zip</format>
</formats>
<includeBaseDirectory>false</includeBaseDirectory>
<fileSets>
<fileSet>
<outputDirectory>/fl</outputDirectory>
<directory>../${project.basedir}/../python/ppml/scripts</directory>
</fileSet>


<fileSet>
<outputDirectory>/fl/lib</outputDirectory>
<directory>../${project.basedir}/ppml/target</directory>
<includes>
<include>bigdl-ppml-*-jar-with-dependencies.jar</include>
<include>bigdl-ppml-*-python-api.zip</include>
</includes>
</fileSet>
</fileSets>
</assembly>

0 comments on commit 82192a7

Please sign in to comment.