Пример #1
0
    def record_wf_profile(self, wf_name, proc_num, writeto=_MYSQL, conn=None):
        wf_id = self.cleaned_profiles[wf_name].keys()[0]
        wf_id_bin = binascii.unhexlify(wf_id)
        wf_mapping = self.args.target
        wf_iter_num = self.args.iter
        wf_graph = os.path.join(current_location, MONITOR_CONFIGS["graph_profile_store"], wf_id)
        wf_memory_profile = os.path.join(current_location, MONITOR_CONFIGS["memory_profile_store"], wf_id) + ".dat"
        wf_total_time = self.cleaned_profiles[wf_name][wf_id]["exec"]
        wf_sub_time = self.cleaned_profiles[wf_name][wf_id]["submitted"]

        # convert graph to json in node link format
        from dispel4py.workflow_graph import drawDot, draw
        dot_data = draw(self.workflow)
        # store dot file to graph data path
        with open(wf_graph + ".dot", "w") as outfile:
            outfile.write(dot_data)

        # store png file if store_png set to true
        if MONITOR_CONFIGS.get("store_png", False):
            drawDot(self.workflow, wf_graph + ".png")

        if writeto == _MYSQL:
            cursor = conn.cursor()

            try:
                cursor.execute(
                    "INSERT INTO WorkflowProfiles("
                    "WF_SubmissionID, WF_Name, WF_Mapping, "
                    "WF_ProcessorNum, WF_IterationNum, WF_TotalTime, "
                    "WF_Submitted, WF_GraphDescription, WF_MemoryProfile) " +
                    "VALUES(%s, %s, %s, %s, %s, %s, %s, %s, %s)",
                    (wf_id_bin, wf_name, wf_mapping,
                     proc_num, wf_iter_num, wf_total_time,
                     wf_sub_time, wf_graph, wf_memory_profile)
                )
                conn.commit()
                return True

            except StandardError, e:
                print(cursor._last_executed)
                print e
                conn.rollback()
                return False
Пример #2
0
def test_dot_composite():
    def inc(a):
        return a + 1

    def dec(a):
        return a - 1

    graph = WorkflowGraph()
    prod = TestProducer()
    comp = create_iterative_chain([inc, dec])
    cons = TestOneInOneOut()
    graph.connect(prod, "output", comp, "input")
    graph.connect(comp, "output", cons, "input")
    graph.inputmappings = {"input": (prod, "input")}
    root_prod = TestProducer()
    root_graph = WorkflowGraph()
    root_graph.connect(root_prod, "output", graph, "input")
    dot = draw(root_graph)
    tools.ok_("subgraph cluster_" in dot)
Пример #3
0
def test_dot_composite():

    def inc(a):
        return a+1

    def dec(a):
        return a-1

    graph = WorkflowGraph()
    prod = TestProducer()
    comp = create_iterative_chain([inc, dec])
    cons = TestOneInOneOut()
    graph.connect(prod, 'output', comp, 'input')
    graph.connect(comp, 'output', cons, 'input')
    graph.inputmappings = {'input': (prod, 'input')}
    root_prod = TestProducer()
    root_graph = WorkflowGraph()
    root_graph.connect(root_prod, 'output', graph, 'input')
    dot = draw(root_graph)
    tools.ok_('subgraph cluster_' in dot)
Пример #4
0
def test_dot_pipeline():
    graph = WorkflowGraph()
    prod = TestProducer()
    cons = TestOneInOneOut()
    graph.connect(prod, "output", cons, "input")
    draw(graph)
Пример #5
0
def test_dot_pipeline():
    graph = WorkflowGraph()
    prod = TestProducer()
    cons = TestOneInOneOut()
    graph.connect(prod, 'output', cons, 'input')
    draw(graph)