Skip to content

Commit 1a0970c

Browse files
committed
fix cm2020 check hostResource
1 parent 89b8a6b commit 1a0970c

File tree

4 files changed

+15
-10
lines changed

4 files changed

+15
-10
lines changed

cpp/wedpr-computing/ppc-psi/src/cm2020-psi/CM2020PSIImpl.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -152,15 +152,14 @@ void CM2020PSIImpl::asyncRunTask()
152152
{
153153
return;
154154
}
155-
155+
CM2020_PSI_LOG(INFO) << LOG_DESC("noticePeerToFinish") << printTaskInfo(task);
156156
psi->noticePeerToFinish(task);
157157
});
158-
// check the memory
159-
checkHostResource(m_config->minNeededMemoryGB());
160-
addPendingTask(taskState);
161-
162158
try
163159
{
160+
addPendingTask(taskState);
161+
// check the memory
162+
checkHostResource(m_config->minNeededMemoryGB());
164163
// prepare reader and writer
165164
auto dataResource = task->selfParty()->dataResource();
166165
auto reader = loadReader(task->id(), dataResource, DataSchema::Bytes);
@@ -321,6 +320,7 @@ void CM2020PSIImpl::stop()
321320

322321
void CM2020PSIImpl::onReceivedErrorNotification(const std::string& _taskID)
323322
{
323+
CM2020_PSI_LOG(INFO) << LOG_DESC("onReceivedErrorNotification") << LOG_KV("taskID", _taskID);
324324
// finish the task while the peer is failed
325325
auto taskState = findPendingTask(_taskID);
326326
if (taskState)

cpp/wedpr-computing/ppc-psi/src/ecdh-multi-psi/EcdhMultiPSIImpl.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,9 +131,9 @@ void EcdhMultiPSIImpl::asyncRunTask(
131131
psi->removePartner(taskID);
132132
psi->removePendingTask(taskID);
133133
});
134+
addPendingTask(taskState);
134135
// check the memory
135136
checkHostResource(m_config->minNeededMemoryGB());
136-
addPendingTask(taskState);
137137
// over the peer limit
138138
if (_task->getAllPeerParties().size() > c_max_peer_size)
139139
{

cpp/wedpr-computing/ppc-psi/src/labeled-psi/LabeledPSIImpl.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,9 +115,9 @@ void LabeledPSIImpl::asyncRunTask(
115115

116116
psi->noticePeerToFinish(_task);
117117
});
118+
addPendingTask(taskState);
118119
// check the memory
119120
checkHostResource(m_config->minNeededMemoryGB());
120-
addPendingTask(taskState);
121121

122122
auto oprfClient = std::make_shared<EcdhOprfClient>(
123123
sizeof(apsi::Item::value_type) + sizeof(apsi::LabelKey), m_config->hash(),

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

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,10 @@ void TaskState::removeGeneratedOutputFile()
201201
{
202202
return;
203203
}
204+
if (!m_writer)
205+
{
206+
return;
207+
}
204208
auto outputDataResource = m_task->selfParty()->dataResource();
205209
if (!outputDataResource->desc())
206210
{
@@ -271,10 +275,11 @@ void TaskState::onTaskFinished(TaskResult::Ptr _result, bool _noticePeer)
271275
void TaskState::onPeerNotifyFinish()
272276
{
273277
PSI_LOG(WARNING) << LOG_BADGE("onReceivePeerError") << LOG_KV("taskID", m_task->id());
274-
auto tesult = std::make_shared<TaskResult>(task()->id());
275-
tesult->setError(std::make_shared<bcos::Error>(
278+
auto result = std::make_shared<TaskResult>(task()->id());
279+
result->setError(std::make_shared<bcos::Error>(
276280
(int)PSIRetCode::PeerNotifyFinish, "job participant sent an error"));
277-
onTaskFinished(std::move(tesult), false);
281+
onTaskFinished(std::move(result), false);
282+
removeGeneratedOutputFile();
278283
}
279284

280285
// Note: must store the result serially

0 commit comments

Comments
 (0)