提交 e4838a83 编写于 作者: G guru4elephant

make previous op's name visible to current op, we assume DAG is sequential in...

make previous op's name visible to current op, we assume DAG is sequential in this case, will refine later
上级 a83f1254
...@@ -45,6 +45,8 @@ int DagView::init(Dag* dag, const std::string& service_name) { ...@@ -45,6 +45,8 @@ int DagView::init(Dag* dag, const std::string& service_name) {
<< "at:" << si; << "at:" << si;
return ERR_MEM_ALLOC_FAILURE; return ERR_MEM_ALLOC_FAILURE;
} }
VLOG(2) << "stage[" << si << "] name: " << stage->full_name;
VLOG(2) << "stage[" << si << "] node size: " << stage->nodes.size();
vstage->full_name = service_name + NAME_DELIMITER + stage->full_name; vstage->full_name = service_name + NAME_DELIMITER + stage->full_name;
uint32_t node_size = stage->nodes.size(); uint32_t node_size = stage->nodes.size();
// create tls view node // create tls view node
...@@ -63,16 +65,30 @@ int DagView::init(Dag* dag, const std::string& service_name) { ...@@ -63,16 +65,30 @@ int DagView::init(Dag* dag, const std::string& service_name) {
} }
// initialize a TLS op object // initialize a TLS op object
VLOG(2) << "dag view initialized: \n"
<< "node id: " << node->id << "\n"
<< "node name: " << node->name << "\n"
<< "node type: " << node->type;
if (op->init(_bus, dag, node->id, node->name, node->type, node->conf) != if (op->init(_bus, dag, node->id, node->name, node->type, node->conf) !=
0) { 0) {
LOG(WARNING) << "Failed init op, type:" << node->type; LOG(WARNING) << "Failed init op, type:" << node->type;
return ERR_INTERNAL_FAILURE; return ERR_INTERNAL_FAILURE;
} }
op->set_full_name(service_name + NAME_DELIMITER + node->full_name); op->set_full_name(service_name + NAME_DELIMITER + node->full_name);
vnode->conf = node; vnode->conf = node;
vnode->op = op; vnode->op = op;
vstage->nodes.push_back(vnode); vstage->nodes.push_back(vnode);
} }
// TODO(guru4elephant): this seems buggy, please review later
if (si > 0) {
VLOG(2) << "set op pre name: \n"
<< "current op name: " << vstage->nodes.back()->op->op_name()
<< " previous op name: "
<< _view[si-1]->nodes.back()->op->op_name();
vstage->nodes.back()->op->set_pre_node_name(
_view[si-1]->nodes.back()->op->op_name());
}
_view.push_back(vstage); _view.push_back(vstage);
} }
......
...@@ -127,6 +127,7 @@ int Op::process(bool debug) { ...@@ -127,6 +127,7 @@ int Op::process(bool debug) {
return -1; return -1;
} }
}*/ }*/
if (debug && _timer) { if (debug && _timer) {
_timer->check("depend"); _timer->check("depend");
} }
......
...@@ -128,10 +128,18 @@ class Op { ...@@ -128,10 +128,18 @@ class Op {
const char* name() const; const char* name() const;
const std::string& op_name() const { return _name; }
const std::string& full_name() const { return _full_name; } const std::string& full_name() const { return _full_name; }
const std::string& pre_name() const { return _pre_node_name; }
void set_full_name(const std::string full_name) { _full_name = full_name; } void set_full_name(const std::string full_name) { _full_name = full_name; }
void set_pre_node_name(const std::string pre_name) {
_pre_node_name = pre_name;
}
const std::string& type() const; const std::string& type() const;
uint32_t id() const; uint32_t id() const;
...@@ -181,6 +189,7 @@ class Op { ...@@ -181,6 +189,7 @@ class Op {
Bus* _bus; Bus* _bus;
Dag* _dag; Dag* _dag;
uint32_t _id; uint32_t _id;
std::string _pre_node_name; // only for sequential execution
std::string _name; std::string _name;
std::string _full_name; // service_workflow_stageindex_opname std::string _full_name; // service_workflow_stageindex_opname
std::string _type; std::string _type;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册