예제 #1
0
    def print_node_tree(cls, node, max_depth, follow_links=()):
        """Top-level function for printing node tree."""
        from ete3 import Tree
        from aiida.cmdline.utils.common import get_node_summary

        echo.echo(get_node_summary(node))

        tree_string = '({});'.format(
            cls._build_tree(node,
                            max_depth=max_depth,
                            follow_links=follow_links))
        tmp = Tree(tree_string, format=1)
        echo.echo(tmp.get_ascii(show_internal=True))
예제 #2
0
    def print_node_tree(cls, node, max_depth, follow_links=()):
        """Top-level function for printing node tree."""
        import warnings
        from aiida.common.warnings import AiidaDeprecationWarning
        warnings.warn(
            'class is deprecated and will be removed in `aiida-core==2.0.0`.',
            AiidaDeprecationWarning)  # pylint: disable=no-member
        from ete3 import Tree
        from aiida.cmdline.utils.common import get_node_summary
        from aiida.cmdline.utils import echo

        echo.echo(get_node_summary(node))

        tree_string = f'({cls._build_tree(node, max_depth=max_depth, follow_links=follow_links)});'
        tmp = Tree(tree_string, format=1)
        echo.echo(tmp.get_ascii(show_internal=True))
예제 #3
0
    def test_get_node_summary(self):
        """Test the `get_node_summary` utility."""
        from aiida.cmdline.utils.common import get_node_summary

        computer_label = self.computer.name  # pylint: disable=no-member

        code = orm.Code(
            input_plugin_name='arithmetic.add',
            remote_computer_exec=[self.computer, '/remote/abs/path'],
        )
        code.store()

        node = orm.CalculationNode()
        node.computer = self.computer
        node.add_incoming(code,
                          link_type=LinkType.INPUT_CALC,
                          link_label='code')
        node.store()

        summary = get_node_summary(node)
        self.assertIn(node.uuid, summary)
        self.assertIn(computer_label, summary)