Skip to content

Commit 5f127c8

Browse files
authored
Merge pull request #109 from ywy2090/feature-milestone2-gateway
upload spdz result file when task failed
2 parents ae83bb0 + 4cc2618 commit 5f127c8

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

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

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,17 @@ void MPCService::doRun(const JobInfo& jobInfo)
231231
std::string outResult;
232232
execCommand(mpcCmd, outExitStatus, outResult);
233233

234+
// 4 upload result file
235+
std::string resultFileHdfsPath = jobInfo.outputFilePath;
236+
std::string resultFileLocalPath = localPathPrefix + MPC_RESULT_FILE;
237+
writeStringToFile(outResult, resultFileLocalPath);
238+
239+
auto resultFileReader =
240+
initialize_lineReader(jobInfo, resultFileLocalPath, DataResourceType::FILE);
241+
auto resultFileWriter =
242+
initialize_lineWriter(jobInfo, resultFileHdfsPath, DataResourceType::HDFS);
243+
readAndSaveFile(resultFileLocalPath, resultFileHdfsPath, resultFileReader, resultFileWriter);
244+
234245
if (outExitStatus != MPC_SUCCESS)
235246
{
236247
MPC_LOG(ERROR) << LOG_DESC("[MPCService][doRun]")
@@ -244,17 +255,6 @@ void MPCService::doRun(const JobInfo& jobInfo)
244255
MPC_LOG(INFO) << LOG_DESC("[MPCService][doRun]") << LOG_KV("jobId", jobId)
245256
<< LOG_DESC("run mpc job successfully");
246257

247-
// 4 upload result file
248-
std::string resultFileHdfsPath = jobInfo.outputFilePath;
249-
std::string resultFileLocalPath = localPathPrefix + MPC_RESULT_FILE;
250-
writeStringToFile(outResult, resultFileLocalPath);
251-
252-
auto resultFileReader =
253-
initialize_lineReader(jobInfo, resultFileLocalPath, DataResourceType::FILE);
254-
auto resultFileWriter =
255-
initialize_lineWriter(jobInfo, resultFileHdfsPath, DataResourceType::HDFS);
256-
readAndSaveFile(resultFileLocalPath, resultFileHdfsPath, resultFileReader, resultFileWriter);
257-
258258
MPC_LOG(INFO) << LOG_DESC("do run mpc") << LOG_KV("jodId", jobInfo.jobId)<< LOG_KV("timecost(ms)", utcSteadyTime() - startT);
259259
}
260260

0 commit comments

Comments
 (0)