Skip to content

Commit 31d8b4c

Browse files
committed
fix
1 parent 06e5d2e commit 31d8b4c

File tree

1 file changed

+15
-12
lines changed

1 file changed

+15
-12
lines changed

cpp/wedpr-computing/ppc-mpc/src/MPCService.cpp

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -148,10 +148,9 @@ void MPCService::onFailed(const std::string &jobId, const std::string &msg)
148148
jobStatus.timeCostMs = utcSteadyTime() - jobStatus.startTimeMs;
149149

150150
MPC_LOG(INFO) << LOG_DESC("[MPCService][onFailed]")
151-
<< "job failed"
152151
<< LOG_KV("jobId", jobId)
153-
<< LOG_KV("timeCostMs", jobStatus.timeCostMs)
154-
;
152+
<< LOG_KV("msg", msg)
153+
<< LOG_KV("timeCostMs", jobStatus.timeCostMs);
155154
}
156155

157156

@@ -209,17 +208,17 @@ void MPCService::doRun(const JobInfo& jobInfo)
209208
initialize_lineReader(jobInfo, mpcFileHdfsPath, DataResourceType::HDFS);
210209
auto mpcFileWriter =
211210
initialize_lineWriter(jobInfo, mpcFileLocalPath, DataResourceType::FILE);
212-
readAndSaveFile(mpcFileHdfsPath, mpcFileLocalPath, mpcFileReader, mpcFileWriter);
211+
readAndSaveFile(mpcFileHdfsPath, mpcFileLocalPath, mpcFileReader, mpcFileWriter);
213212

214213
// 2 download mpc prepare file
215214
std::string mpcPrepareFileHdfsPath = jobInfo.inputFilePath;
216215

217216
std::string mpcPrepareFileLocalPath = localPathPrefix + MPC_PREPARE_FILE + "-P" + std::to_string(selfIndex) + "-0";
218217
auto datasetFileReader =
219218
initialize_lineReader(jobInfo, mpcPrepareFileHdfsPath, DataResourceType::HDFS);
220-
auto datasetFileWriter =
219+
auto datasetFileWriter =
221220
initialize_lineWriter(jobInfo, mpcPrepareFileLocalPath, DataResourceType::FILE);
222-
readAndSaveFile(mpcPrepareFileHdfsPath, mpcPrepareFileLocalPath, datasetFileReader, datasetFileWriter);
221+
readAndSaveFile(mpcPrepareFileHdfsPath, mpcPrepareFileLocalPath, datasetFileReader, datasetFileWriter);
223222

224223
// 3 run mpc job
225224
int outExitStatus = MPC_SUCCESS;
@@ -309,7 +308,6 @@ void MPCService::runMpcRpc(Json::Value const& request, RespFunc func)
309308
else
310309
{
311310
response["code"] = MPC_DUPLICATED;
312-
313311
response["message"] = "duplicated submit job";
314312
}
315313
}
@@ -387,7 +385,7 @@ void MPCService::doKill(Json::Value const& request, Json::Value& response)
387385

388386
std::string killCmd = "ps -ef |grep mpc | grep " + jobId +
389387
" | grep -v grep | awk '{print $2}' | xargs kill -9";
390-
MPC_LOG(INFO) << LOG_DESC("[MPCService][doKill]") << LOG_KV("killCmd", killCmd);
388+
MPC_LOG(INFO) << LOG_DESC("[MPCService][doKill]") << LOG_KV("jobId", jobId) << LOG_KV("killCmd", killCmd);
391389

392390
int outExitStatus = 0;
393391
std::string outResult;
@@ -397,27 +395,32 @@ void MPCService::doKill(Json::Value const& request, Json::Value& response)
397395
{
398396
message = "Kill mpc job successfully";
399397
onKill(jobId, message);
400-
MPC_LOG(INFO) << LOG_DESC("[MPCService][doKill]") << LOG_DESC(message);
398+
MPC_LOG(INFO) << LOG_DESC("[MPCService][doKill]") << LOG_KV("jobId", jobId) << LOG_DESC(message);
401399
response["code"] = MPC_SUCCESS;
402400
response["message"] = "success";
403401
}
404402
else
405403
{
406404
message = "Kill mpc job failed";
407-
MPC_LOG(INFO) << LOG_DESC("[MPCService][doKill]") << LOG_DESC(message);
405+
MPC_LOG(INFO) << LOG_DESC("[MPCService][doKill]") << LOG_KV("jobId", jobId) << LOG_DESC(message)
406+
<< LOG_KV("outExitStatus", outExitStatus)
407+
<< LOG_KV("outResult", outResult);
408408
response["code"] = MPC_FAILED;
409409
response["message"] = message;
410410
}
411411
}
412412
catch (const std::exception& e)
413413
{
414414
const std::string diagnostic_information = std::string(boost::diagnostic_information(e));
415-
MPC_LOG(INFO) << LOG_DESC("[MPCService][doKill]") << LOG_DESC("kill mpc job failed:")
415+
MPC_LOG(INFO) << LOG_DESC("[MPCService][doKill]") << LOG_KV("jobId", jobId) << LOG_DESC("kill mpc job failed:")
416416
<< LOG_DESC(diagnostic_information);
417417
response["code"] = MPC_FAILED;
418418
response["message"] = diagnostic_information;
419419
}
420-
MPC_LOG(INFO) << LOG_DESC("kill mpc job") << LOG_KV("timecost(ms)", utcSteadyTime() - startT);
420+
MPC_LOG(INFO) << LOG_DESC("kill mpc job")
421+
<< LOG_KV("jobId", jobId)
422+
<< LOG_KV("request", response.toStyledString())
423+
<< LOG_KV("timecost(ms)", utcSteadyTime() - startT);
421424
}
422425

423426
void MPCService::killMpcRpc(Json::Value const& request, RespFunc func)

0 commit comments

Comments
 (0)