Skip to content

Commit

Permalink
chore: 调整任务不存在时相关日志
Browse files Browse the repository at this point in the history
  • Loading branch information
MistEO committed Sep 22, 2024
1 parent ffac9b9 commit 7422274
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
5 changes: 3 additions & 2 deletions source/MaaFramework/Task/Context.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ bool Context::override_next(const std::string& name, const std::vector<std::stri

auto data_opt = get_pipeline_data(name);
if (!data_opt) {
LogError << "get_pipeline_data failed" << VAR(name);
LogError << "get_pipeline_data failed, task not exist" << VAR(name);
return false;
}

Expand Down Expand Up @@ -151,6 +151,7 @@ std::optional<Context::PipelineData> Context::get_pipeline_data(const std::strin
{
auto override_it = pipeline_override_.find(task_name);
if (override_it != pipeline_override_.end()) {
LogTrace << "found in override" << VAR(task_name);
return override_it->second;
}

Expand All @@ -170,7 +171,7 @@ std::optional<Context::PipelineData> Context::get_pipeline_data(const std::strin
return raw_it->second;
}

LogError << "task not found" << VAR(task_name);
LogWarn << "task not found" << VAR(task_name);
return std::nullopt;
}

Expand Down
6 changes: 3 additions & 3 deletions source/MaaFramework/Task/PipelineTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ bool PipelineTask::run()
// there is no pretask for the entry, so we use the entry itself
auto begin_opt = context_->get_pipeline_data(entry_);
if (!begin_opt) {
LogError << "get_pipeline_data failed" << VAR(entry_);
LogError << "get_pipeline_data failed, task not exist" << VAR(entry_);
return false;
}

Expand Down Expand Up @@ -58,7 +58,7 @@ bool PipelineTask::run()
bool is_interrupt = static_cast<size_t>(pos) >= next_size;
auto hit_opt = context_->get_pipeline_data(node_detail.name);
if (!hit_opt) {
LogError << "get_pipeline_data failed" << VAR(node_detail.name);
LogError << "get_pipeline_data failed, task not exist" << VAR(node_detail.name);
return false;
}
PipelineData hit_task = std::move(*hit_opt);
Expand Down Expand Up @@ -91,7 +91,7 @@ bool PipelineTask::run()

auto top_opt = context_->get_pipeline_data(top);
if (!top_opt) {
LogError << "get_pipeline_data failed" << VAR(top);
LogError << "get_pipeline_data failed, task not exist" << VAR(top);
return false;
}
current = std::move(*top_opt);
Expand Down
6 changes: 3 additions & 3 deletions source/MaaFramework/Task/TaskBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ RecoResult TaskBase::run_recognition(const cv::Mat& image, const PipelineData::N

auto cur_opt = context_->get_pipeline_data(cur_task_);
if (!cur_opt) {
LogError << "get_pipeline_data failed" << VAR(cur_task_);
LogError << "get_pipeline_data failed, task not exist" << VAR(cur_task_);
return {};
}
bool current_focus = cur_opt->focus;
Expand All @@ -94,7 +94,7 @@ RecoResult TaskBase::run_recognition(const cv::Mat& image, const PipelineData::N
for (const auto& name : list) {
auto data_opt = context_->get_pipeline_data(name);
if (!data_opt) {
LogError << "get_pipeline_data failed" << VAR(name);
LogError << "get_pipeline_data failed, task not exist" << VAR(name);
continue;
}
const auto& pipeline_data = *data_opt;
Expand Down Expand Up @@ -158,7 +158,7 @@ NodeDetail TaskBase::run_action(const RecoResult& reco)

auto cur_opt = context_->get_pipeline_data(reco.name);
if (!cur_opt) {
LogError << "get_pipeline_data failed" << VAR(reco.name);
LogError << "get_pipeline_data failed, task not exist" << VAR(reco.name);
return {};
}
const auto& pipeline_data = *cur_opt;
Expand Down

0 comments on commit 7422274

Please sign in to comment.