Skip to content

Commit

Permalink
MGM: add callbacks to Converter job creation and add some logging whe…
Browse files Browse the repository at this point in the history
…n callbacks are cancelled
  • Loading branch information
apeters1971 committed Jan 8, 2025
1 parent facebae commit 2dc4492
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
10 changes: 10 additions & 0 deletions mgm/convert/ConversionJob.cc
Original file line number Diff line number Diff line change
Expand Up @@ -366,6 +366,10 @@ void ConversionJob::DoIt() noexcept
}
}

if (mCallback) {
eos_static_info("[tpc]: notifying callback with 'cancel' after successfull tpc jobs");
mCallback->Cancel();
}
return;
}

Expand All @@ -389,6 +393,12 @@ void ConversionJob::HandleError(const std::string& emsg,
}

mStatus.store(Status::FAILED, std::memory_order_relaxed);

if (mCallback) {
eos_static_info("[tpc]: notifying callback with 'cancel' after error='%s' details-'%s'",
emsg.c_str(), details.c_str());
mCallback->Cancel();
}
}

//------------------------------------------------------------------------------
Expand Down
6 changes: 4 additions & 2 deletions mgm/convert/ConverterDriver.cc
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ ConverterDriver::Convert(ThreadAssistant& assistant) noexcept
auto conversion_info = ConversionInfo::parseConversionString(std::get<1>(info));

if (conversion_info != nullptr) {
auto job = std::make_shared<ConversionJob>(fid, *conversion_info.get());
auto job = std::make_shared<ConversionJob>(fid, *conversion_info.get(),std::get<2>(info));
mThreadPool.PushTask<void>([ = ]() {
job->DoIt();
HandlePostJobRun(job);
Expand Down Expand Up @@ -249,7 +249,9 @@ bool
ConverterDriver::QdbHelper::AddPendingJob(const JobInfoT& jobinfo)
{
try {
return mQHashPending.hset(std::to_string(std::get<0>(jobinfo)), std::get<1>(jobinfo));
bool hset = mQHashPending.hset(std::to_string(std::get<0>(jobinfo)), std::get<1>(jobinfo));
std::cerr << "hset: " << hset << std::endl;
return hset;
} catch (const std::exception& e) {
eos_static_crit("msg=\"Error encountered while trying to add pending "
"conversion job\" emsg=\"%s\" conversion_id=%s",
Expand Down

0 comments on commit 2dc4492

Please sign in to comment.