Пример #1
0
def graph_expand(source, depth, link_types, height=200, show=True):
    jp_graph = Jp_Graph_Data()
    graph = jp_graph.graph_expand(source, depth, link_types)
    graph_name = graph.reset_puml().render_and_save_to_elk()
    if show:
        sleep(1)
        show_graph(graph_name, height)
    return graph
Пример #2
0
def graph_expand(source, depth, link_types, height=200, show=True):
    jp_graph = Jp_Graph_Data()
    graph = jp_graph.graph_expand(source, depth, link_types)
    graph_name = graph.reset_puml().render_and_save_to_elk()
    if show:
        sleep(1)
        # give time for the graph to be saved (needs better solution)
        show_graph(graph_name, height)
    return graph
Пример #3
0
def project_schema(project_name):
    jp_graph = Jp_Graph_Data()
    api_issues = jp_graph.api_issues
    elk_to_slack = jp_graph.elk_to_slack
    issues = api_issues.search_using_lucene(f'Project:{project_name.upper()}')
    graph_name = elk_to_slack.save_issues_as_new_graph(issues)
    Lambda_Graph().wait_for_elk_to_index_graph(graph_name)
    graph = jp_graph.jira_links(graph_name)
    display(HTML(f"<h2>{project_name}</h2>"))
    render_puml(Graph_View(graph).view_schema())
Пример #4
0
class test_Jp_Graph_Data(TestCase):
    def setUp(self):
        self.jp_graph_data = Jp_Graph_Data()
        self.result = None

    def tearDown(self):
        if self.result is not None:
            Dev.pprint(self.result)

    def test_issue(self):
        issue_id = 'RISK-12'
        assert self.jp_graph_data.issue(issue_id).get('Key') == issue_id

    def test_issues(self):
        issues_ids = ['RISK-12', 'RISK-234']
        self.result = list(set(
            self.jp_graph_data.issues(issues_ids))) == issues_ids

    def test_jira_links(self):
        depth = 1
        key = 'PERSON-1'
        graph = self.jp_graph_data.jira_links(key, depth)
        assert len(graph.nodes) > 5
        assert len(graph.edges) > 5

    def test_jira_search(self):
        assert len(self.jp_graph_data.jira_search('people di*')) > 10

    def test_graph_expand(self):
        depth = 1
        key = 'RISK-1610'
        link_types = 'has RISK'
        graph = self.jp_graph_data.graph_expand(key, depth, link_types)

        assert len(graph.nodes) == 7
        assert len(graph.edges) == 6

    def test_run_with_trace(self):
        from osbot_utils.decorators.trace.Trace_Call import Trace_Call
        self.result = Trace_Call().invoke_method(
            test_Jp_Graph_Data.test_graph_expand, self)
Пример #5
0
def search(query, show_img=False, height=200):
    params = ['Issue\ Type:Role']
    jp_graph = Jp_Graph_Data()
    api_issues = jp_graph.api_issues
    elk_to_slack = jp_graph.elk_to_slack
    api_issues.elastic().set_index(
        api_issues.index)  # BUG: this should happen automatically
    issues = api_issues.search_using_lucene(query)
    graph_name = elk_to_slack.save_issues_as_new_graph(issues)
    print(
        "Created graph '{0}' with search for '{1}' with '{2}' matches".format(
            graph_name, query, len(issues)))

    if show_img:
        sleep(1)
        show_graph(graph_name, height)
    return issues
Пример #6
0
 def setUp(self):
     self.jp_graph_data = Jp_Graph_Data()
     self.result = None
Пример #7
0
def jira_links(source, depth=1, show=True):
    graph_data = Jp_Graph_Data()
    graph = graph_data.jira_links(source, depth)
    if show:
        render_puml(graph.render_puml().puml)
    return graph