diff options
-rw-r--r-- | lib/element.cpp | 2 | ||||
-rw-r--r-- | lib/top_block.cpp | 8 | ||||
-rw-r--r-- | query/__init__.py | 8 |
3 files changed, 11 insertions, 7 deletions
diff --git a/lib/element.cpp b/lib/element.cpp index 008027c..1781fc7 100644 --- a/lib/element.cpp +++ b/lib/element.cpp @@ -21,7 +21,7 @@ Element::Element(const std::string &name) size_t which = 0; while (true) { - const std::string uid = str(boost::format("%s %u") % name % which); + const std::string uid = str(boost::format("%s_%u") % name % which); try { this->set_uid(uid); diff --git a/lib/top_block.cpp b/lib/top_block.cpp index ee3f0e8..515d898 100644 --- a/lib/top_block.cpp +++ b/lib/top_block.cpp @@ -98,6 +98,8 @@ void TopBlock::wait(void) //however, thread group cant be joined twice and this breaks some qa code //(*this)->thread_group->join_all(); + //QA lockup detection setup + const bool lockup_debug = getenv("GRAS_LOCKUP_DEBUG") != NULL; boost::system_time check_done_time = boost::get_system_time(); bool has_a_done = false; @@ -105,19 +107,19 @@ void TopBlock::wait(void) while (not (*this)->token.unique()) { wait_thread_yield(); - if (boost::get_system_time() > check_done_time) + if (lockup_debug and boost::get_system_time() > check_done_time) { if (has_a_done) { std::cerr << this->query("{\"path\":\"/topology.dot\"}") << std::endl; - check_done_time += boost::posix_time::seconds(2); + check_done_time += boost::posix_time::seconds(3); } BOOST_FOREACH(Apology::Worker *w, (*this)->executor->get_workers()) { BlockActor *actor = dynamic_cast<BlockActor *>(w->get_actor()); if (actor->data->block_state == BLOCK_STATE_DONE) has_a_done = true; } - check_done_time += boost::posix_time::seconds(1); + check_done_time += boost::posix_time::seconds(2); } } } diff --git a/query/__init__.py b/query/__init__.py index cca8354..403e68c 100644 --- a/query/__init__.py +++ b/query/__init__.py @@ -26,14 +26,16 @@ class MyHandler(BaseHTTPServer.BaseHTTPRequestHandler): args = server_registry[s.server] path = o.path + #generate the topology png if path == "/topology.png": s.send_response(200) s.send_header("Content-type", "image/png") s.end_headers() - dot = args['top_block'].query(json.dumps(dict(path='/topology.dot'))) + dot_markup = args['top_block'].query(json.dumps(dict(path='/topology.dot'))) import subprocess - p = subprocess.Popen(args=["dot", "-T", "png"], stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE) - (stdout, stderr) = p.communicate(input=dot) + dot_exe = os.environ.get("DOT_EXECUTABLE", "dot") + p = subprocess.Popen(args=[dot_exe, "-T", "png"], stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + (stdout, stderr) = p.communicate(input=dot_markup) s.wfile.write(stdout) return |