예제 #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 display(graph):
    '''
    Visualises the input graph.
    '''
    display_png(drawDot(graph), raw=True)    
예제 #3
0
def display(graph):
    '''
    Visualises the input graph.
    '''
    display_png(drawDot(graph), raw=True)