Skip to content

Commit 96876f6

Browse files
authored
update toolkit version (#110)
* fix ci * update toolkit version * add Dockerfile * add agencyID to psi/mpc serviceName * support fetch log and fetch job result seperately
1 parent 5f127c8 commit 96876f6

File tree

12 files changed

+95
-38
lines changed

12 files changed

+95
-38
lines changed

.github/workflows/cpp_full_node_workflow.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ jobs:
3333
strategy:
3434
fail-fast: false
3535
matrix:
36-
os: [macos-12, ubuntu-20.04]
36+
os: [macos-13, ubuntu-20.04]
3737
steps:
3838
- uses: actions/checkout@v2
3939
with:
@@ -74,6 +74,7 @@ jobs:
7474
if: runner.os == 'macOS'
7575
run: |
7676
bash -x cpp/tools/install_depends.sh -o macos
77+
rm -rf /Users/runner/work/WeDPR-Component/WeDPR-Component/vcpkg/buildtrees/gsasl
7778
mkdir -p cpp/build && cd cpp/build && cmake -DBUILD_STATIC=ON -DTESTS=ON -DCOVERAGE=ON -DCMAKE_TOOLCHAIN_FILE=${{ env.VCPKG_ROOT }}/scripts/buildsystems/vcpkg.cmake ../
7879
make -j3
7980
- name: Publish Error

.github/workflows/cpp_sdk_workflow.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ jobs:
3333
strategy:
3434
fail-fast: false
3535
matrix:
36-
os: [ubuntu-22.04, windows-2019, macos-12]
36+
os: [ubuntu-22.04, windows-2019, macos-13]
3737
steps:
3838
- uses: actions/checkout@v2
3939
with:

.github/workflows/cpp_toolkit_workflow.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ jobs:
3333
strategy:
3434
fail-fast: false
3535
matrix:
36-
os: [ubuntu-22.04, windows-2019, macos-12]
36+
os: [ubuntu-22.04, windows-2019, macos-13]
3737
steps:
3838
- uses: actions/checkout@v2
3939
with:
@@ -72,7 +72,7 @@ jobs:
7272
- name: Build for windows
7373
if: runner.os == 'Windows'
7474
run: |
75-
mkdir -p cpp/build && cd cpp/build && cmake -G "Visual Studio 16 2019" -A x64 -DBUILD_PYTHON=ON -DCMAKE_BUILD_TYPE=Release -DTESTS=OFF -DBUILD_WEDPR_TOOLKIT=ON -DVCPKG_TARGET_TRIPLET=x64-windows-static -DVCPKG_HOST_TRIPLET=x64-windows-static -DCMAKE_TOOLCHAIN_FILE=c:/vcpkg/scripts/buildsystems/vcpkg.cmake .. && MSBuild /version && MSBuild WeDPR-Component.sln /p:Configuration=Release /p:Platform=x64
75+
mkdir -p cpp/build && cd cpp/build && cmake -G "Visual Studio 16 2019" -A x64 -DBUILD_PYTHON=OFF -DCMAKE_BUILD_TYPE=Release -DTESTS=OFF -DBUILD_WEDPR_TOOLKIT=ON -DVCPKG_TARGET_TRIPLET=x64-windows-static -DVCPKG_HOST_TRIPLET=x64-windows-static -DCMAKE_TOOLCHAIN_FILE=c:/vcpkg/scripts/buildsystems/vcpkg.cmake .. && MSBuild /version && MSBuild WeDPR-Component.sln /p:Configuration=Release /p:Platform=x64
7676
- name: Build for linux
7777
if: runner.os == 'Linux'
7878
run: |

cpp/tools/install_depends.sh

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -75,12 +75,12 @@ install_centos_depends()
7575
{
7676
LOG_INFO "install depends for centos ..."
7777
# install the basic package
78-
sudo yum install -y lcov bison flex epel-release centos-release-scl flex bison patch devtoolset-11 rh-perl530-perl cmake3 zlib-devel ccache lcov python-devel python3-devel krb5-devel autoconf
78+
sudo yum install -y lcov bison flex epel-release centos-release-scl flex bison patch devtoolset-11 rh-perl530-perl cmake3 zlib-devel ccache lcov python-devel python3-devel autoconf
7979
LOG_INFO "install basic-package-depends for centos success..."
8080

81-
LOG_INFO "install gsasl ... "
82-
install_gsasl_depend "centos"
83-
LOG_INFO "install gsasl success!"
81+
#LOG_INFO "install gsasl ... "
82+
#install_gsasl_depend "centos"
83+
#LOG_INFO "install gsasl success!"
8484

8585
LOG_INFO "install nasm ... "
8686
install_nasm_depend
@@ -93,12 +93,12 @@ install_ubuntu_depends()
9393
{
9494
LOG_INFO "install depends for ubuntu ..."
9595
# install the basic package
96-
sudo apt install -y lcov bison flex g++ libssl-dev openssl cmake git build-essential autoconf texinfo flex patch bison libgmp-dev zlib1g-dev automake pkg-config libtool wget libkrb5-dev autoconf
96+
sudo apt install -y lcov bison flex g++ libssl-dev openssl cmake git build-essential autoconf texinfo flex patch bison libgmp-dev zlib1g-dev automake pkg-config libtool wget autoconf
9797
LOG_INFO "install basic-package-depends for ubuntu success..."
9898

99-
LOG_INFO "install gsasl ... "
100-
install_gsasl_depend "ubuntu"
101-
LOG_INFO "install gsasl success!"
99+
#LOG_INFO "install gsasl ... "
100+
#install_gsasl_depend "ubuntu"
101+
#LOG_INFO "install gsasl success!"
102102

103103
LOG_INFO "install nasm ... "
104104
install_nasm_depend
@@ -125,9 +125,9 @@ install_iconv_depend()
125125
install_macos_depends()
126126
{
127127
LOG_INFO "install depends for macos ..."
128-
brew install autoconf nasm lcov iconv
129-
install_gsasl_depend "macos"
130-
install_iconv_depend
128+
brew install autoconf nasm lcov
129+
#install_gsasl_depend "macos"
130+
#install_iconv_depend
131131
LOG_INFO "install depends for macos success ..."
132132
}
133133

cpp/wedpr-helper/ppc-utilities/Utilities.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,11 @@ inline std::string generateUUID()
6464
static thread_local auto uuid_gen = boost::uuids::basic_random_generator<std::random_device>();
6565
return boost::uuids::to_string(uuid_gen());
6666
}
67+
68+
inline std::string getServiceName(std::string const& agencyID, std::string const& serviceID)
69+
{
70+
return agencyID + "_" + serviceID;
71+
}
6772
template <typename T>
6873
inline std::string printVector(T const& list)
6974
{

cpp/wedpr-initializer/Initializer.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
#include "ppc-psi/src/labeled-psi/LabeledPSIFactory.h"
4141
#include "ppc-psi/src/ra2018-psi/RA2018PSIFactory.h"
4242
#include "ppc-tools/src/config/PPCConfig.h"
43+
#include "wedpr-helper/ppc-utilities/Utilities.h"
4344
#include <tbb/tbb.h>
4445
#include <thread>
4546

@@ -86,8 +87,9 @@ void Initializer::init(ppc::gateway::IGateway::Ptr const& gateway)
8687
TransportBuilder transportBuilder;
8788
// register the serviceInfo
8889
auto serviceConfig = m_serviceConfigBuilder.buildServiceConfig();
89-
auto entryPoint =
90-
m_serviceConfigBuilder.buildEntryPoint(PSI_SERVICE_TYPE, m_config->accessEntrypoint());
90+
auto entryPoint = m_serviceConfigBuilder.buildEntryPoint(
91+
getServiceName(m_config->agencyID(), PSI_SERVICE_TYPE), m_config->accessEntrypoint());
92+
9193
serviceConfig.addEntryPoint(entryPoint);
9294
auto serviceMeta = serviceConfig.encode();
9395
m_config->frontConfig()->setMeta(serviceMeta);

cpp/wedpr-main/mpc-node/MPCInitializer.cpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
#include "ppc-framework/protocol/Constant.h"
2323
#include "ppc-mpc/src/MPCService.h"
2424
#include "ppc-tools/src/config/PPCConfig.h"
25+
#include "wedpr-helper/ppc-utilities/Utilities.h"
2526
#include "wedpr-protocol/protocol/src/ServiceConfig.h"
2627
#include "wedpr-transport/sdk/src/TransportBuilder.h"
2728

@@ -61,7 +62,7 @@ void MPCInitializer::init(std::string const& _configPath)
6162
auto threadPool = std::make_shared<bcos::ThreadPool>("mpc-pool", threadPoolSize);
6263

6364
INIT_LOG(INFO) << LOG_DESC("init the mpc threadpool")
64-
<< LOG_KV("threadPoolSize", threadPoolSize);
65+
<< LOG_KV("threadPoolSize", threadPoolSize);
6566

6667
auto mpcService = std::make_shared<MPCService>();
6768
mpcService->setMPCConfig(mpcConfig);
@@ -71,11 +72,11 @@ void MPCInitializer::init(std::string const& _configPath)
7172
m_rpc->registerHandler("run", std::bind(&MPCService::runMpcRpc, mpcService,
7273
std::placeholders::_1, std::placeholders::_2));
7374
m_rpc->registerHandler("asyncRun", std::bind(&MPCService::asyncRunMpcRpc, mpcService,
74-
std::placeholders::_1, std::placeholders::_2));
75+
std::placeholders::_1, std::placeholders::_2));
7576
m_rpc->registerHandler("kill", std::bind(&MPCService::killMpcRpc, mpcService,
7677
std::placeholders::_1, std::placeholders::_2));
7778
m_rpc->registerHandler("query", std::bind(&MPCService::queryMpcRpc, mpcService,
78-
std::placeholders::_1, std::placeholders::_2));
79+
std::placeholders::_1, std::placeholders::_2));
7980
INIT_LOG(INFO) << LOG_DESC("init the mpc rpc success");
8081
// init the transport
8182
initTransport(pt);
@@ -89,8 +90,8 @@ void MPCInitializer::initTransport(boost::property_tree::ptree const& property)
8990

9091
// add the service meta
9192
ServiceConfigBuilder serviceConfigBuilder;
92-
auto entryPoint =
93-
serviceConfigBuilder.buildEntryPoint(MPC_SERVICE_TYPE, m_config->accessEntrypoint());
93+
auto entryPoint = serviceConfigBuilder.buildEntryPoint(
94+
getServiceName(m_config->agencyID(), MPC_SERVICE_TYPE), m_config->accessEntrypoint());
9495
auto serviceConfig = serviceConfigBuilder.buildServiceConfig();
9596
serviceConfig.addEntryPoint(entryPoint);
9697
auto serviceMeta = serviceConfig.encode();

docker-files/cpp/Dockerfile

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
FROM ubuntu:18.04 as builder
2+
3+
LABEL maintainer [email protected]
4+
5+
WORKDIR /
6+
7+
ARG SOURCE_BRANCH
8+
ENV DEBIAN_FRONTEND=noninteractive \
9+
SOURCE=${SOURCE_BRANCH:-master}
10+
11+
RUN apt-get -q update && apt-get install -qy --no-install-recommends \
12+
vim curl git make build-essential cmake \
13+
libgmp-dev flex bison patch libzstd-dev unzip ninja-build pkg-config curl zip tar ccache uuid-runtime automake autoconf \
14+
m4 tcpdump net-tools libkrb5-dev krb5-user pkg-config default-libmysqlclient-dev gcc g++ \
15+
&& ln -fs /usr/share/zoneinfo/Asia/Shanghai /etc/localtime \
16+
&& apt-get install -qy --no-install-recommends tzdata \
17+
&& dpkg-reconfigure --frontend noninteractive tzdata \
18+
&& rm -rf /var/lib/apt/lists/*
19+
20+
# install rust
21+
RUN curl https://sh.rustup.rs -sSf | bash -s -- -y
22+
23+
ENV PATH="/root/.cargo/bin:${PATH}"
24+
25+
ENV VCPKG_FORCE_SYSTEM_BINARIES=1
26+
27+
RUN git clone https://github.com/WeBankBlockchain/WeDPR-Component.git --recursive --depth=1 -b ${SOURCE} \
28+
&& mkdir -p WeDPR-Component/cpp/build && cd WeDPR-Component/cpp/build \
29+
&& cmake .. -DBUILD_STATIC=ON && make -j8 && cat /WeDPR-Component/cpp/build/*.log
30+
31+
32+
FROM ubuntu:18.04
33+
LABEL maintainer [email protected]
34+
35+
RUN apt-get -q update && apt-get install -qy --no-install-recommends vim libkrb5-dev krb5-user pkg-config default-libmysqlclient-dev \
36+
&& ln -fs /usr/share/zoneinfo/Asia/Shanghai /etc/localtime \
37+
&& apt-get install -qy --no-install-recommends tzdata \
38+
&& dpkg-reconfigure --frontend noninteractive tzdata \
39+
&& rm -rf /var/lib/apt/lists/*
40+
41+
COPY --from=builder /WeDPR-Component/cpp/build/bin/ppc-gateway-service /usr/local/bin/ppc-gateway-service
42+
COPY --from=builder /WeDPR-Component/cpp/build/bin/ppc-pro-node /usr/local/bin/ppc-pro-node
43+
COPY --from=builder /WeDPR-Component/cpp/build/bin/ppc-air-node /usr/local/bin/ppc-air-node
44+
COPY --from=builder /WeDPR-Component/cpp/build/bin/wedpr-mpc /usr/local/bin/wedpr-mpc

python/ppc_model/model_result/task_result_handler.py

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,13 @@
1111

1212

1313
class TaskResultRequest:
14-
def __init__(self, job_id, task_type, only_fetch_log, user):
14+
def __init__(self, job_id, task_type,
15+
fetch_log: bool,
16+
fetch_result: bool, user):
1517
self.job_id = job_id
1618
self.task_type = task_type
17-
self.only_fetch_log = only_fetch_log
19+
self.fetch_log = fetch_log
20+
self.fetch_result = fetch_result
1821
self.user = user
1922

2023

@@ -346,7 +349,7 @@ def __init__(self, task_result_request: TaskResultRequest, components: Initializ
346349

347350
def get_response(self):
348351
response = dict()
349-
if not self.task_result_request.only_fetch_log:
352+
if self.task_result_request.fetch_result is True:
350353
merged_result = dict()
351354
for result in self.result_list:
352355
merged_result.update(result.to_dict())
@@ -356,13 +359,14 @@ def get_response(self):
356359
response = {"jobPlanetResult": merged_result,
357360
"modelData": self.model_data}
358361
# record the log
359-
log_size, log_path, log_content = self.components.log_retriever.retrieve_log(
360-
self.task_result_request.job_id, self.task_result_request.user)
361-
log_result = {}
362-
log_result.update({"logSize": log_size})
363-
log_result.update({"logPath": log_path})
364-
log_result.update({"logContent": log_content})
365-
response.update({"logDetail": log_result})
362+
if self.task_result_request.fetch_log is True:
363+
log_size, log_path, log_content = self.components.log_retriever.retrieve_log(
364+
self.task_result_request.job_id, self.task_result_request.user)
365+
log_result = {}
366+
log_result.update({"logSize": log_size})
367+
log_result.update({"logPath": log_path})
368+
log_result.update({"logContent": log_content})
369+
response.update({"logDetail": log_result})
366370
return utils.make_response(PpcErrorCode.SUCCESS.get_code(), PpcErrorCode.SUCCESS.get_msg(), response)
367371

368372
def _get_evaluation_result(self):

python/ppc_model/network/http/model_controller.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -105,12 +105,12 @@ def post(self, task_id):
105105
f"get task result, task_id: {task_id}, args: {args}")
106106
user_name = args['user']
107107
task_type = args['jobType']
108-
only_fetch_log = {'True': True, 'False': False}.get(
109-
args['onlyFetchLog'])
108+
fetch_log = args['fetchLog']
109+
fetch_job_result = args['fetchJobResult']
110110
components.logger().info(
111-
f"get_job_direct_result_response, job: {task_id}")
111+
f"get_job_direct_result_response, job: {task_id}, fetch_log: {fetch_log}, fetch_job_result: {fetch_job_result}")
112112
task_result_request = TaskResultRequest(
113-
task_id, task_type, only_fetch_log, user_name)
113+
task_id, task_type, fetch_log, fetch_job_result, user_name)
114114
job_result_handler = TaskResultHandler(
115115
task_result_request=task_result_request, components=components)
116116
response = job_result_handler.get_response()

0 commit comments

Comments
 (0)