You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

graph_handler.py 26 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688
  1. # Copyright 2020 Huawei Technologies Co., Ltd
  2. #
  3. # Licensed under the Apache License, Version 2.0 (the "License");
  4. # you may not use this file except in compliance with the License.
  5. # You may obtain a copy of the License at
  6. #
  7. # http://www.apache.org/licenses/LICENSE-2.0
  8. #
  9. # Unless required by applicable law or agreed to in writing, software
  10. # distributed under the License is distributed on an "AS IS" BASIS,
  11. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. # See the License for the specific language governing permissions and
  13. # limitations under the License.
  14. # ============================================================================
  15. """Define the graph stream handler."""
  16. from mindinsight.conditionmgr.common.utils import NodeBasicInfo
  17. from mindinsight.conditionmgr.condition import TargetTypeEnum as CategoryTypeEnum
  18. from mindinsight.debugger.common.exceptions.exceptions import DebuggerParamValueError, \
  19. DebuggerNodeNotInGraphError, DebuggerGraphNotExistError
  20. from mindinsight.debugger.common.log import LOGGER as log
  21. from mindinsight.debugger.common.utils import is_scope_type
  22. from mindinsight.debugger.stream_cache.debugger_graph import DebuggerGraph
  23. from mindinsight.debugger.stream_cache.debugger_multigraph import DebuggerMultiGraph
  24. from mindinsight.debugger.stream_handler.base_handler import StreamHandlerBase
  25. class GraphHandler(StreamHandlerBase):
  26. """Metadata Handler."""
  27. def __init__(self):
  28. # dict of <graph_name, GraphProto object>
  29. self._graph_proto = {}
  30. # dict of <graph_name, DebuggerGraph object>
  31. self._graph = {}
  32. self._searched_node_list = {}
  33. # list of node names in bfs order
  34. self.bfs_order = []
  35. # dict of <node full name, graph_name>
  36. self.graph_node_map = {}
  37. # dict of <node ui name, Node object> for all graphs
  38. self._all_leaf_nodes = {}
  39. # the whole graph
  40. self._whole_graph = None
  41. @property
  42. def whole_graph(self):
  43. """The property of whole_graph."""
  44. return self._whole_graph
  45. @property
  46. def graph(self):
  47. """The property of graph."""
  48. return self._graph_proto
  49. @property
  50. def graph_names(self):
  51. """The property of graph names."""
  52. return list(self._graph)
  53. @property
  54. def debugger_graph_obj(self):
  55. """The property of graph object."""
  56. return self._graph
  57. def put(self, value):
  58. """
  59. Put value into graph cache. Called by grpc server.
  60. Args:
  61. value (GraphProto): The Graph proto message.
  62. """
  63. log.info("Put graph into cache.")
  64. for graph_name, graph_value in value.items():
  65. self._graph_proto[graph_name] = graph_value
  66. # build sub graph
  67. graph = DebuggerGraph()
  68. graph.build_graph(graph_value)
  69. self._graph[graph_name] = graph
  70. self.bfs_order.extend(graph.get_bfs_order())
  71. leaf_nodes = graph.leaf_nodes
  72. self._all_leaf_nodes.update(leaf_nodes)
  73. for _, node in leaf_nodes.items():
  74. self.graph_node_map[node.full_name] = graph_name
  75. # build whole graph
  76. graph = DebuggerMultiGraph()
  77. graph.add_graph(self._graph)
  78. self._whole_graph = graph
  79. def get(self, filter_condition=None):
  80. """
  81. Get the graph of specific node.
  82. Args:
  83. filter_condition (dict):
  84. - name (str): The full debug node name.
  85. - graph_name (str): The relative graph_name of the node.
  86. - single_node (bool): If True, return the graph from root
  87. to the specific node; else, return the sublayer of the
  88. graph. Default: False.
  89. Returns:
  90. dict, the metadata.
  91. """
  92. try:
  93. self._graph_exists()
  94. except DebuggerGraphNotExistError:
  95. log.warning('The graph is empty. To view a graph, '
  96. 'please start the training script first.')
  97. return {'graph': {}}
  98. graph = {}
  99. if filter_condition is None:
  100. filter_condition = {}
  101. graph = {'graph_names': self.graph_names}
  102. single_node = filter_condition.get('single_node', False)
  103. name = filter_condition.get('name')
  104. graph_name = filter_condition.get('graph_name')
  105. if single_node is True:
  106. nodes = self._get_single_node(name, graph_name)
  107. else:
  108. nodes = self._list_nodes(name, graph_name)
  109. graph.update(nodes)
  110. return {'graph': graph}
  111. def _get_single_node(self, name, graph_name=None):
  112. """
  113. Search node, and return every layer nodes until this node.
  114. Args:
  115. graph_name(str): The graph_name.
  116. name (str): The name of node.
  117. Returns:
  118. dict, every layer nodes until this node.
  119. """
  120. if graph_name:
  121. graph = self._get_graph(graph_name=graph_name)
  122. searched_graph = graph.search_single_node(name)
  123. else:
  124. searched_graph = self._whole_graph.search_single_node(name)
  125. return searched_graph
  126. def _list_nodes(self, scope, graph_name):
  127. """
  128. Get the nodes of every layer in graph.
  129. Args:
  130. scope (str): The name of a scope.
  131. graph_name(str): The graph name.
  132. Returns:
  133. TypedDict{'nodes': ['Node_1', ...], 'graph_names': ['graph_name_1', ...]},
  134. format is {'nodes': [<NodeObject>], 'graph_names': [<str>]}.
  135. example:
  136. {
  137. "nodes" : [
  138. {
  139. "attr" :
  140. {
  141. "index" : "i: 0\n"
  142. },
  143. "input" : {},
  144. "name" : "input_tensor",
  145. "output" :
  146. {
  147. "Default/TensorAdd-op17" :
  148. {
  149. "edge_type" : "data",
  150. "scope" : "name_scope",
  151. "shape" : [1, 16, 128, 128]
  152. }
  153. },
  154. "output_i" : -1,
  155. "proxy_input" : {},
  156. "proxy_output" : {},
  157. "independent_layout" : False,
  158. "subnode_count" : 0,
  159. "type" : "Data"
  160. }
  161. ]
  162. }
  163. """
  164. if graph_name:
  165. graph = self._get_graph(graph_name, scope)
  166. nodes = graph.list_node_by_scope(scope=scope)
  167. res = {'nodes': nodes}
  168. else:
  169. nodes = self._whole_graph.list_node_by_scope(scope=scope)
  170. res = {'nodes': nodes}
  171. return res
  172. def get_tensor_history(self, node_name, graph_name=None, depth=0):
  173. """
  174. Get the tensor history of a specified node.
  175. Args:
  176. node_name (str): The debug name of the node.
  177. graph_name (str): The graph_name. Default: None.
  178. depth (int): The number of layers the user
  179. wants to trace. Default is 0.
  180. Returns:
  181. dict, basic tensor history, only including tensor name and tensor type and node type.
  182. """
  183. graph_name, node_name = self._parse_node_name(node_name, graph_name)
  184. graph = self._get_graph(graph_name=graph_name, node_name=node_name)
  185. # validate node type, scope node has no tensor history
  186. node_type = graph.get_node_type(node_name)
  187. if is_scope_type(node_type):
  188. log.error("Scope type node has no tensor history.")
  189. raise DebuggerParamValueError("Invalid leaf node name.")
  190. # get tensor history
  191. tensor_history, cur_outputs_nums = graph.get_tensor_history(node_name, depth)
  192. # add the tensor type for tensor history
  193. self._update_tensor_history(tensor_history[0:cur_outputs_nums], 'output', graph_name)
  194. self._update_tensor_history(tensor_history[cur_outputs_nums:], 'input', graph_name)
  195. log.debug("Get %d tensors in tensor history for node <%s>.", len(tensor_history), node_name)
  196. return {'tensor_history': tensor_history}
  197. @staticmethod
  198. def _update_tensor_history(tensor_history, tensor_type, graph_name):
  199. """
  200. Add tensor source type for tensor history.
  201. Args:
  202. tensor_history (list[dict]): Tensor history from Graph stream. Each element has two
  203. keys: `node_type` and `name`. `node_type` refers to the type of the node which
  204. the tensor come from. `name` refers to the tensor name.
  205. tensor_type (str): The source type of the tensor. `input` or `output`.
  206. graph_name (str): The graph name.
  207. """
  208. for single_tensor_info in tensor_history:
  209. single_tensor_info['type'] = tensor_type
  210. single_tensor_info['graph_name'] = graph_name
  211. def search_nodes(self, pattern):
  212. """
  213. Search nodes by given pattern.
  214. Args:
  215. pattern (dict): Filter condition.
  216. - name (str): The name pattern.
  217. - graph_name (str): The graph name.
  218. - node_category (str): The node_category. Default: None
  219. - condition (dict): The additional filter condition.
  220. Returns:
  221. dict, the searched node.
  222. """
  223. graph_name = pattern.pop('graph_name', None)
  224. search_nodes = self.get_searched_nodes(pattern, graph_name)
  225. # construct to search tree
  226. if not self._has_graph_scope(graph_name):
  227. for graph_name, searched_node_list in search_nodes.items():
  228. graph = self._get_graph(graph_name=graph_name)
  229. format_nodes = graph.get_nodes(searched_node_list)
  230. return {'nodes': format_nodes}
  231. # deal with graph_name is None
  232. res = []
  233. for graph_name, graph in self._graph.items():
  234. format_nodes = graph.get_nodes(search_nodes.get(graph_name, []))
  235. if not format_nodes:
  236. continue
  237. self._add_graph_scope_for_nodes(format_nodes, graph_name)
  238. search_graph = {
  239. 'name': graph_name,
  240. 'type': 'name_scope',
  241. 'nodes': format_nodes
  242. }
  243. res.append(search_graph)
  244. return {'nodes': res}
  245. def get_searched_node_list(self, pattern, graph_name):
  246. """Get searched node list in single graph."""
  247. searched_nodes = self.get_searched_nodes(pattern, graph_name)
  248. return searched_nodes.get(graph_name, [])
  249. def get_searched_nodes(self, pattern, graph_name=None):
  250. """
  251. Search nodes by given pattern.
  252. Args:
  253. pattern (dict): Filter condition.
  254. - name (str): The name pattern.
  255. - node_category (str): The node_category. Default: None
  256. - condition (dict): The additional filter condition.
  257. graph_name (str): The graph name. If not given, search in all sub graphs. Default: None.
  258. Returns:
  259. dict, the searched nodes. The format is dict of <graph_name, list[Node]>.
  260. """
  261. if not graph_name:
  262. graph_names = self.graph_names
  263. else:
  264. graph_names = [graph_name]
  265. search_nodes = {}
  266. for sub_graph_name in graph_names:
  267. search_nodes[sub_graph_name] = self._search_in_single_graph(pattern, sub_graph_name)
  268. return search_nodes
  269. def _search_in_single_graph(self, pattern, graph_name=None):
  270. """
  271. Search nodes by given pattern.
  272. Args:
  273. pattern (dict): Filter condition.
  274. - name (str): The name pattern.
  275. - node_category (str): The node_category. Default: None.
  276. - condition (dict): The additional filter condition.
  277. graph_name (str): The graph name.
  278. Returns:
  279. list, the searched node list.
  280. """
  281. temp_node_list = []
  282. node_category = pattern.get('node_category')
  283. if graph_name:
  284. graph = self._get_graph(graph_name=graph_name)
  285. else:
  286. graph = self._whole_graph
  287. # filter nodes by name
  288. if pattern.get('name'):
  289. if node_category:
  290. # get leaf nodes for forward filter
  291. temp_node_list = graph.search_leaf_nodes_by_pattern(pattern.get('name'))
  292. else:
  293. # optimize search nodes
  294. temp_node_list = graph.search_nodes_by_pattern(pattern.get('name'))
  295. if not temp_node_list:
  296. log.debug("No node named %s", pattern.get('name'))
  297. return []
  298. # filter nodes by category
  299. if node_category:
  300. node_category = self._get_inner_node_category(node_category)
  301. condition = pattern['condition'].copy() if pattern.get('condition') else {}
  302. condition['search_range'] = temp_node_list
  303. temp_node_list = graph.search_nodes_by_category(node_category, condition=condition)
  304. return temp_node_list
  305. @staticmethod
  306. def _get_inner_node_category(node_category):
  307. """
  308. Get inner node category.
  309. Args:
  310. node_category (str): The node category supported in
  311. mindinsight.conditionmgr.condition.TargetTypeEnum.
  312. Returns:
  313. CategoryTypeEnum, the translated value.
  314. """
  315. try:
  316. res = CategoryTypeEnum(node_category)
  317. except ValueError as err:
  318. log.error("Invalid node category. %s", err)
  319. raise DebuggerParamValueError("Invalid node_category.")
  320. return res
  321. def get_nodes_by_scope(self, scope_name, graph_name):
  322. """
  323. Get node by a given scope name.
  324. Args:
  325. scope_name (str): The name of scope.
  326. graph_name (str): The relative graph_name of the watched node. Default: None.
  327. Returns:
  328. list[Node], a list of node.
  329. """
  330. if graph_name:
  331. graph = self._get_graph(graph_name)
  332. else:
  333. graph = self._whole_graph
  334. return graph.search_leaf_nodes_by_pattern(scope_name)
  335. def get_graph_id_by_name(self, node_name):
  336. """
  337. Get graph id by full name.
  338. Args:
  339. node_name (str): The name of the node.
  340. Returns:
  341. str, the graph name of the node.
  342. Raises:
  343. DebuggerNodeNotInGraphError: If can not find the node in all graphs.
  344. """
  345. if node_name:
  346. for graph_name, sub_graph in self._graph.items():
  347. if sub_graph.exist_node(name=node_name):
  348. return graph_name
  349. log.error('Failed to find node %s in graph. Please make sure the graph has been sent and '
  350. 'the node name is correct, and try again.', node_name)
  351. raise DebuggerGraphNotExistError
  352. def get_graph_id_by_full_name(self, node_name):
  353. """
  354. Get graph id by full name.
  355. Args:
  356. node_name (str): The full name of the node.
  357. Returns:
  358. str, the graph name of the node.
  359. Raises:
  360. DebuggerNodeNotInGraphError: If can not find the node in all graphs.
  361. """
  362. graph_id = self.graph_node_map.get(node_name) if node_name else None
  363. if not graph_id:
  364. log.warning("Failed to get graph id by full name: %s", node_name)
  365. return graph_id
  366. def get_node_type(self, node_name, graph_name=None):
  367. """
  368. Get the type of the specified node.
  369. Args:
  370. node_name (str): The debug name of the node.
  371. graph_name (str): The relative graph_name of the node. Default: None.
  372. Returns:
  373. A string of the node type, name_scope or leaf.
  374. """
  375. if graph_name:
  376. graph = self._get_graph(node_name=node_name, graph_name=graph_name)
  377. else:
  378. graph = self._whole_graph
  379. node_type = graph.get_node_type(node_name)
  380. return node_type
  381. def get_full_name(self, node_name, graph_name=None):
  382. """Get full name according to ui node name."""
  383. full_name = ''
  384. if node_name:
  385. if graph_name:
  386. graph = self._get_graph(node_name=node_name, graph_name=graph_name)
  387. else:
  388. graph = self._whole_graph
  389. full_name = graph.get_full_name_by_node_name(node_name)
  390. return full_name
  391. def get_node_basic_info(self, node_name, graph_name):
  392. """Get node basic info with graph scope."""
  393. graph_name, node_name = self._parse_node_name(node_name=node_name, graph_name=graph_name)
  394. graph = self._get_graph(graph_name, node_name)
  395. full_name = graph.get_full_name_by_node_name(node_name)
  396. node_type = graph.get_node_type(node_name)
  397. return self.construct_node_basic_info(full_name, graph_name, node_name, node_type)
  398. def get_tensor_graph(self, tensor_name, graph_name):
  399. """
  400. Get tensor graph according to node name.
  401. Args:
  402. tensor_name (str): Tensor name, format is "node_name:<node_value>".
  403. graph_name (str): The relative graph_name of the node. Default: None.
  404. Returns:
  405. dict, relative node.
  406. """
  407. node_name, _ = tensor_name.rsplit(':', 1)
  408. graph = self._get_graph(graph_name=graph_name, node_name=node_name)
  409. tensor_graph = graph.get_tensor_graph(node_name)
  410. return {'graph': tensor_graph}
  411. @staticmethod
  412. def construct_node_basic_info(full_name, graph_name, node_name, node_type):
  413. """Construct node basic info."""
  414. node_name_with_graph_scope = '/'.join([graph_name, node_name]) if node_name else graph_name
  415. return NodeBasicInfo(name=node_name_with_graph_scope, full_name=full_name, type=node_type)
  416. def get_node_basic_info_by_scope(self, scope_name, graph_name):
  417. """
  418. Get node by a given scope name.
  419. Args:
  420. scope_name (str): The name of scope.
  421. graph_name (str): The relative graph_name of the watched node. Default: None.
  422. Returns:
  423. list[NodeBasicInfo], a list of node.
  424. """
  425. graph_name, node_name = self._parse_node_name(scope_name, graph_name)
  426. graph = self._get_graph(graph_name)
  427. nodes = graph.search_leaf_nodes_by_pattern(node_name)
  428. res = [self.construct_node_basic_info(full_name=node.full_name,
  429. graph_name=graph_name,
  430. node_name=node.name,
  431. node_type=node.type) for node in nodes]
  432. return res
  433. def get_node_name_by_full_name(self, full_name, graph_name):
  434. """Get UI node name by full name and graph name."""
  435. if graph_name and full_name:
  436. graph = self._get_graph(graph_name)
  437. node_name = graph.get_node_name_by_full_name(full_name)
  438. else:
  439. node_name = ''
  440. log.debug("Get empty full name.")
  441. return node_name
  442. def get_node_by_bfs_order(self, node_name=None, ascend=True):
  443. """
  444. Traverse the graph in order of breath-first search by given node.
  445. Args:
  446. node_name (str): The name of current chosen leaf node.
  447. ascend (bool): If True, traverse the input nodes;
  448. If False, traverse the output nodes. Default is True.
  449. Returns:
  450. Union[None, dict], the next node object in dict type or None.
  451. """
  452. bfs_order = self.bfs_order
  453. length = len(bfs_order)
  454. if not bfs_order:
  455. log.error('Cannot get the BFS order of the graph!')
  456. msg = 'Cannot get the BFS order of the graph!'
  457. raise DebuggerParamValueError(msg)
  458. if node_name is None:
  459. if ascend is False:
  460. next_node = None
  461. else:
  462. next_node = bfs_order[0]
  463. else:
  464. try:
  465. index = bfs_order.index(node_name)
  466. log.debug("The index of the node in BFS list is: %d", index)
  467. except ValueError as err:
  468. log.error('Cannot find the node: %s. Please check '
  469. 'the node name: %s', node_name, err)
  470. msg = f'Cannot find the node: {node_name}. ' \
  471. f'Please check the node name {err}.'
  472. raise DebuggerParamValueError(msg)
  473. next_node = self._get_next_node_in_bfs(index, length, ascend)
  474. return next_node
  475. def _get_next_node_in_bfs(self, index, length, ascend):
  476. """
  477. Get the next node in bfs order.
  478. Args:
  479. index (int): The current index.
  480. length (int): The number of all leaf nodes.
  481. ascend (bool): Whether get the node in ascend order or not.
  482. Returns:
  483. Union[None, dict], the next node object in dict type or None.
  484. """
  485. next_node = None
  486. if 0 <= index < length:
  487. if ascend is True and index < length - 1:
  488. next_node = self.bfs_order[index + 1]
  489. elif ascend is False and index > 0:
  490. next_node = self.bfs_order[index - 1]
  491. return next_node
  492. def _graph_exists(self):
  493. """
  494. Check if the graph has been loaded in the debugger cache.
  495. Raises:
  496. DebuggerGraphNotExistError: If the graph does not exist.
  497. """
  498. if not self._graph:
  499. log.error('The graph does not exist. Please start the '
  500. 'training script and try again.')
  501. raise DebuggerGraphNotExistError
  502. def _get_graph(self, graph_name=None, node_name=None):
  503. """
  504. Get the graph object according to graph name and node name.
  505. Args:
  506. graph_name (str): The graph name.
  507. node_name (str): The node name.
  508. Returns:
  509. DebuggerGraph, the graph object.
  510. Raises:
  511. DebuggerGraphNotExistError: If the graph does not exist.
  512. """
  513. if not graph_name and not node_name and len(self._graph) == 1:
  514. # get the graph if there is only one graph
  515. return list(self._graph.values())[0]
  516. graph_name = graph_name if graph_name else self.get_graph_id_by_name(node_name)
  517. graph = self._graph.get(graph_name) if graph_name else None
  518. # get graph according to graph name and check the node
  519. if graph and (not node_name or graph.exist_node(name=node_name)):
  520. return graph
  521. log.error('The graph %s does not exist node %s.', graph_name, node_name)
  522. raise DebuggerGraphNotExistError
  523. def _has_graph_scope(self, graph_name):
  524. """Check if query with graph_scope."""
  525. return bool(graph_name is None and len(self._graph) > 1)
  526. def validate_graph_name(self, graph_name):
  527. """Validate graph_name."""
  528. if graph_name and self._graph.get(graph_name) is None:
  529. log.error("No graph named %s in debugger cache.", graph_name)
  530. raise DebuggerGraphNotExistError
  531. if not graph_name and len(self._graph) == 1:
  532. graph_name = self.graph_names[0]
  533. return graph_name
  534. def _add_graph_scope_for_nodes(self, nodes, graph_name):
  535. """
  536. Add graph scope for nodes.
  537. Args:
  538. nodes (list[Node]): List of nodes object.
  539. graph_name (str): The graph name.
  540. """
  541. def _get_updated_node_info(cur_node, node_type):
  542. """Add graph scope in key."""
  543. old_node = cur_node.get(node_type)
  544. if not old_node:
  545. return
  546. new_values = {}
  547. for old_name, node_info in old_node.items():
  548. new_name = '/'.join([graph_name, old_name]) if old_name else graph_name
  549. new_values[new_name] = node_info
  550. cur_node[node_type] = new_values
  551. for node in nodes:
  552. node['name'] = '/'.join([graph_name, node['name']]) if node['name'] else graph_name
  553. _get_updated_node_info(node, 'input')
  554. _get_updated_node_info(node, 'output')
  555. if node.get('nodes'):
  556. self._add_graph_scope_for_nodes(node.get('nodes'), graph_name)
  557. def _parse_node_name(self, node_name, graph_name):
  558. """
  559. Check if the node name should have graph scope.
  560. Args:
  561. node_name (str): The ui node name.
  562. graph_name (str): The graph name.
  563. Returns:
  564. str, parsed graph name.
  565. str, parsed node name.
  566. """
  567. node_name = '' if node_name is None else node_name
  568. if self._has_graph_scope(graph_name):
  569. names = node_name.split("/", 1)
  570. graph_name = names[0]
  571. node_name = names[1] if len(names) == 2 else ''
  572. if graph_name is None and len(self._graph) == 1:
  573. graph_name = self.graph_names[0]
  574. return graph_name, node_name
  575. def validate_node_name(self, node_name, graph_name):
  576. """
  577. Validate the graph exist the specified node.
  578. Args:
  579. node_name (str): The ui node name.
  580. graph_name (str): The graph name.
  581. Raises:
  582. DebuggerNodeNotInGraphError: If can not find the node in all graphs.
  583. """
  584. graph = self._get_graph(graph_name=graph_name)
  585. if not graph.exist_node(name=node_name):
  586. log.error("graph %s doesn't find node: %s.", graph_name, node_name)
  587. raise DebuggerNodeNotInGraphError(node_name)