Skip to content

Commit fa96b32

Browse files
authored
update dependency install (#79)
* update dependency install * download missed model_prepare.csv && dataset, support multiple-model worker * add handshake before establish a job * add push_by_topic * fix push_by_topic * fix ecdh-psi not return status
1 parent 937ea69 commit fa96b32

File tree

26 files changed

+240
-102
lines changed

26 files changed

+240
-102
lines changed

cpp/ppc-framework/protocol/Task.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -63,14 +63,10 @@ class TaskResult
6363
virtual void setFileInfo(FileInfo::Ptr _fileInfo) { m_fileInfo = std::move(_fileInfo); }
6464

6565
// serialize the taskResult to json
66-
virtual Json::Value serializeToJson() const
66+
virtual Json::Value serializeToJson()
6767
{
6868
Json::Value response;
6969
response["taskID"] = m_taskID;
70-
if (!m_status.empty())
71-
{
72-
response["status"] = m_status;
73-
}
7470
if (m_timeCost)
7571
{
7672
response["timeCost"] = std::to_string(m_timeCost) + "ms";
@@ -81,7 +77,7 @@ class TaskResult
8177
response["fileID"] = m_fileInfo->fileID;
8278
response["fileMd5"] = m_fileInfo->fileMd5;
8379
}
84-
if (m_error)
80+
if (m_error && m_error->errorCode() != 0)
8581
{
8682
response["code"] = m_error->errorCode();
8783
response["message"] = m_error->errorMessage();
@@ -91,6 +87,10 @@ class TaskResult
9187
response["code"] = 0;
9288
response["message"] = "success";
9389
}
90+
if (!m_status.empty())
91+
{
92+
response["status"] = m_status;
93+
}
9494
return response;
9595
}
9696

cpp/wedpr-computing/ppc-pir/src/OtPIRImpl.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -540,7 +540,7 @@ void OtPIRImpl::runSenderGenerateCipher(PirTaskMessage taskMessage)
540540

541541
void OtPIRImpl::onReceiverTaskDone(bcos::Error::Ptr _error)
542542
{
543-
if (m_taskState->taskDone())
543+
if (m_taskState->taskDone() && (!_error || _error->errorCode() == 0))
544544
{
545545
return;
546546
}

cpp/wedpr-computing/ppc-psi/src/bs-ecdh-psi/protocol/BsEcdhResult.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ class BsEcdhResult : public protocol::TaskResult
4343
[[nodiscard]] Json::Value const& data() const { return m_data; }
4444

4545
// serialize the taskResult to json
46-
[[nodiscard]] Json::Value serializeToJson() const override
46+
[[nodiscard]] Json::Value serializeToJson() override
4747
{
4848
Json::Value response;
4949
if (m_error && error()->errorCode())

cpp/wedpr-computing/ppc-psi/src/cm2020-psi/core/CM2020PSIReceiver.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -931,7 +931,7 @@ void CM2020PSIReceiver::onReceiverException(const std::string& _module, const st
931931

932932
void CM2020PSIReceiver::onReceiverTaskDone(bcos::Error::Ptr _error)
933933
{
934-
if (m_taskState->taskDone())
934+
if (m_taskState->taskDone() && (!_error || _error->errorCode() == 0))
935935
{
936936
return;
937937
}

cpp/wedpr-computing/ppc-psi/src/cm2020-psi/core/CM2020PSISender.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -832,7 +832,7 @@ void CM2020PSISender::onSenderException(const std::string& _message, const std::
832832

833833
void CM2020PSISender::onSenderTaskDone(bcos::Error::Ptr _error)
834834
{
835-
if (m_taskState->taskDone())
835+
if (m_taskState->taskDone() && (!_error || _error->errorCode() == 0))
836836
{
837837
return;
838838
}

cpp/wedpr-computing/ppc-psi/src/cm2020-psi/protocol/CM2020PSIResult.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ class CM2020PSIResult : public protocol::TaskResult
4444
}
4545

4646
// serialize the taskResult to json
47-
[[nodiscard]] Json::Value serializeToJson() const override
47+
[[nodiscard]] Json::Value serializeToJson() override
4848
{
4949
Json::Value response;
5050
response["taskID"] = taskID();

cpp/wedpr-computing/ppc-psi/src/labeled-psi/protocol/LabeledPSIResult.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ class LabeledPSIResult : public protocol::TaskResult
4747
const std::vector<std::vector<std::string>>& getOutputs() { return m_outputs; }
4848

4949
// serialize the taskResult to json
50-
Json::Value serializeToJson() const override
50+
Json::Value serializeToJson() override
5151
{
5252
Json::Value response;
5353
response["taskID"] = taskID();

cpp/wedpr-computing/ppc-psi/src/psi-framework/TaskState.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,11 @@ class TaskState : public std::enable_shared_from_this<TaskState>
225225
-1, "task " + m_task->id() + " failed for " +
226226
boost::lexical_cast<std::string>(m_failedCount) + " error!");
227227
result->setError(std::move(error));
228+
result->setStatus(ppc::protocol::toString(ppc::protocol::TaskStatus::FAILED));
229+
}
230+
else
231+
{
232+
result->setStatus(ppc::protocol::toString(ppc::protocol::TaskStatus::COMPLETED));
228233
}
229234

230235
// clear file
@@ -239,6 +244,7 @@ class TaskState : public std::enable_shared_from_this<TaskState>
239244
<< LOG_KV("msg", boost::diagnostic_information(e));
240245
auto error = std::make_shared<bcos::Error>(-1, boost::diagnostic_information(e));
241246
result->setError(std::move(error));
247+
result->setStatus(ppc::protocol::toString(ppc::protocol::TaskStatus::FAILED));
242248
}
243249
if (m_callback)
244250
{
@@ -262,6 +268,11 @@ class TaskState : public std::enable_shared_from_this<TaskState>
262268
}
263269
try
264270
{
271+
_result->setStatus(ppc::protocol::toString(ppc::protocol::TaskStatus::COMPLETED));
272+
if (_result->error() && _result->error()->errorCode() != 0)
273+
{
274+
_result->setStatus(ppc::protocol::toString(ppc::protocol::TaskStatus::FAILED));
275+
}
265276
// Note: we consider that the task success even if the handler exception
266277
if (_noticePeer && !m_onlySelfRun && _result->error() &&
267278
_result->error()->errorCode() && m_notifyPeerFinishHandler)
@@ -288,6 +299,7 @@ class TaskState : public std::enable_shared_from_this<TaskState>
288299
<< LOG_KV("msg", boost::diagnostic_information(e));
289300
auto error = std::make_shared<bcos::Error>(-1, boost::diagnostic_information(e));
290301
_result->setError(std::move(error));
302+
_result->setStatus(ppc::protocol::toString(ppc::protocol::TaskStatus::FAILED));
291303
}
292304
if (m_callback)
293305
{

cpp/wedpr-transport/ppc-gateway/ppc-gateway/gateway/router/LocalRouter.cpp

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,8 @@ void LocalRouter::registerTopic(bcos::bytesConstRef _nodeID, std::string const&
6464
}
6565
for (auto const& msgInfo : msgQueue->messages)
6666
{
67+
LOCAL_ROUTER_LOG(INFO) << LOG_DESC("registerTopic, dispatcher the holding msg queue")
68+
<< LOG_KV("topic", topic) << LOG_KV("nodeID", printNodeID(_nodeID));
6769
dispatcherMessage(msgInfo.msg, msgInfo.callback, false);
6870
}
6971
}
@@ -80,6 +82,15 @@ bool LocalRouter::dispatcherMessage(
8082
P2PMessage::Ptr const& msg, ReceiveMsgFunc callback, bool holding)
8183
{
8284
auto frontList = chooseReceiver(msg);
85+
auto commonCallback = [](bcos::Error::Ptr error) {
86+
if (!error || error->errorCode() == 0)
87+
{
88+
return;
89+
}
90+
LOCAL_ROUTER_LOG(WARNING) << LOG_DESC("dispatcherMessage to front failed")
91+
<< LOG_KV("code", error->errorCode())
92+
<< LOG_KV("msg", error->errorMessage());
93+
};
8394
// find the front
8495
if (!frontList.empty())
8596
{
@@ -93,15 +104,7 @@ bool LocalRouter::dispatcherMessage(
93104
}
94105
else
95106
{
96-
front->onReceiveMessage(msg->msg(), [](bcos::Error::Ptr error) {
97-
if (!error || error->errorCode() == 0)
98-
{
99-
return;
100-
}
101-
LOCAL_ROUTER_LOG(WARNING) << LOG_DESC("dispatcherMessage to front failed")
102-
<< LOG_KV("code", error->errorCode())
103-
<< LOG_KV("msg", error->errorMessage());
104-
});
107+
front->onReceiveMessage(msg->msg(), commonCallback);
105108
}
106109
i++;
107110
}
@@ -122,7 +125,12 @@ bool LocalRouter::dispatcherMessage(
122125
// no connection found, cache the topic message and dispatcher later
123126
if (msg->header()->routeType() == (uint16_t)RouteType::ROUTE_THROUGH_TOPIC && m_cache)
124127
{
125-
m_cache->insertCache(msg->header()->optionalField()->topic(), msg, callback);
128+
// send response when hodling the message
129+
if (callback)
130+
{
131+
callback(nullptr);
132+
}
133+
m_cache->insertCache(msg->header()->optionalField()->topic(), msg, commonCallback);
126134
return true;
127135
}
128136
return false;

cpp/wedpr-transport/ppc-rpc/src/Rpc.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,6 @@ void Rpc::runTask(Json::Value const& _req, RespFunc _respFunc)
226226
_respFunc(result->error(), result->serializeToJson());
227227
return;
228228
}
229-
230229
_respFunc(_result->error(), _result->serializeToJson());
231230
});
232231
}

0 commit comments

Comments
 (0)