提交 4656659a 编写于 作者: Z zhangchaoltt 提交者: zaxon

cyber: put assignment of inner_thr_confs in policy (#8408)

* cyber: simplify code

* cyber: put assignment of inner_thr_confs in policy
上级 0a6a5daa
......@@ -49,6 +49,9 @@ SchedulerChoreography::SchedulerChoreography() {
apollo::cyber::proto::CyberConfig cfg;
if (PathExists(cfg_file) && GetProtoFromFile(cfg_file, &cfg)) {
for (auto& thr : cfg.scheduler_conf().threads()) {
inner_thr_confs_[thr.name()] = thr;
}
const apollo::cyber::proto::ChoreographyConf& choreography_conf =
cfg.scheduler_conf().choreography_conf();
proc_num_ = choreography_conf.choreography_processor_num();
......
......@@ -48,6 +48,10 @@ SchedulerClassic::SchedulerClassic() {
apollo::cyber::proto::CyberConfig cfg;
if (PathExists(cfg_file) && GetProtoFromFile(cfg_file, &cfg)) {
for (auto& thr : cfg.scheduler_conf().threads()) {
inner_thr_confs_[thr.name()] = thr;
}
classic_conf_ = cfg.scheduler_conf().classic_conf();
for (auto& group : classic_conf_.groups()) {
auto& group_name = group.name();
......
......@@ -24,7 +24,6 @@
#include "cyber/common/global_data.h"
#include "cyber/common/log.h"
#include "cyber/croutine/croutine.h"
#include "cyber/scheduler/processor_context.h"
namespace apollo {
namespace cyber {
......
......@@ -27,13 +27,12 @@
#include "cyber/croutine/croutine.h"
#include "cyber/proto/scheduler_conf.pb.h"
#include "cyber/scheduler/processor_context.h"
namespace apollo {
namespace cyber {
namespace scheduler {
class ProcessorContext;
using croutine::CRoutine;
class Processor {
......
......@@ -30,8 +30,6 @@ namespace scheduler {
using croutine::CRoutine;
class Processor;
class ProcessorContext {
public:
virtual void Shutdown();
......
......@@ -60,9 +60,6 @@ Scheduler* Instance() {
std::unordered_map<std::string, InnerThread> inner_thr_confs;
if (PathExists(cfg_file) && GetProtoFromFile(cfg_file, &cfg)) {
policy = cfg.scheduler_conf().policy();
for (auto& thr : cfg.scheduler_conf().threads()) {
inner_thr_confs[thr.name()] = thr;
}
} else {
AWARN << "No sched conf found, use default conf.";
}
......@@ -74,7 +71,6 @@ Scheduler* Instance() {
AWARN << "Invalid scheduler policy: " << policy;
obj = new SchedulerClassic();
}
obj->SetInnerThreadConfs(inner_thr_confs);
instance.store(obj, std::memory_order_release);
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册