flowcraft/generator/inspect.py
def flush_overview(self):
        """Displays the default overview of the pipeline execution from the
        :attr:`status_info`, :attr:`processes` and :attr:`run_status`
        attributes into stdout.
        """

        colors = {
            "W": 1,
            "R": 2,
            "C": 3
        }

        pc = {
            "running": 3,
            "complete": 3,
            "aborted": 4,
            "error": 4
        }

        curses.init_pair(1, curses.COLOR_WHITE, curses.COLOR_BLACK)
        curses.init_pair(2, curses.COLOR_BLUE, curses.COLOR_BLACK)
        curses.init_pair(3, curses.COLOR_GREEN, curses.COLOR_BLACK)
        curses.init_pair(4, curses.COLOR_MAGENTA, curses.COLOR_BLACK)

        # self.screen.erase()

        height, width = self.screen.getmaxyx()
        win = curses.newpad(height, 2000)

        # Add static header
        header = "Pipeline [{}] inspection at {}. Status: ".format(
            self.pipeline_tag, strftime("%Y-%m-%d %H:%M:%S", gmtime()))

        win.addstr(0, 0, header)
        win.addstr(0, len(header), self.run_status,
                   curses.color_pair(pc[self.run_status]))
        submission_str = "{0:23.23}  {1:23.23}  {2:23.23}  {3:23.23}".format(
            "Running: {}".format(
                sum([len(x["submitted"]) for x in self.processes.values()])
            ),
            "Failed: {}".format(
                sum([len(x["failed"]) for x in self.processes.values()])
            ),
            "Retrying: {}".format(
                sum([len(x["retry"]) for x in self.processes.values()])
            ),
            "Completed: {}".format(
                sum([len(x["finished"]) for x in self.processes.values()])
            )
        )

        win.addstr(
            1, 0, submission_str, curses.color_pair(1)
        )

        headers = ["", "Process", "Running", "Complete", "Error",
                   "Avg Time", "Max Mem", "Avg Read", "Avg Write"]
        header_str = "{0: ^1} " \
                     "{1: ^25}  " \
                     "{2: ^7} " \
                     "{3: ^7} " \
                     "{4: ^7} " \
                     "{5: ^10} " \
                     "{6: ^10} " \
                     "{7: ^10} " \
                     "{8: ^10} ".format(*headers)
        self.max_width = len(header_str)
        win.addstr(3, 0, header_str, curses.A_UNDERLINE | curses.A_REVERSE)

        # Get display size
        top = self.top_line
        bottom = self.screen_lines - 4 + self.top_line

        # Fetch process information
        for p, process in enumerate(
                list(self.processes.keys())[top:bottom]):

            if process not in self.process_stats:
                vals = ["-"] * 8
                txt_fmt = curses.A_NORMAL
            else:
                ref = self.process_stats[process]
                vals = [ref["completed"],
                        len(self.processes[process]["failed"]),
                        ref["realtime"],
                        ref["maxmem"], ref["avgread"],
                        ref["avgwrite"]]
                txt_fmt = curses.A_BOLD

            proc = self.processes[process]
            if proc["retry"]:
                completed = "{}({})".format(len(proc["submitted"]),
                                            len(proc["retry"]))
            else:
                completed = "{}".format(len(proc["submitted"]))

            win.addstr(
                4 + p, 0, "{0: ^1} "
                          "{1:25.25}  "
                          "{2: ^7} "
                          "{3: ^7} "
                          "{4: ^7} "
                          "{5: ^10} "
                          "{6: ^10} "
                          "{7: ^10} "
                          "{8: ^10} ".format(
                                proc["barrier"],
                                process,
                                completed,
                                *vals),
                curses.color_pair(colors[proc["barrier"]]) | txt_fmt)

        win.clrtoeol()
        win.refresh(0, self.padding, 0, 0, height-1, width-1)
def flush_overview(self):
        """Displays the default overview of the pipeline execution from the
        :attr:`status_info`, :attr:`processes` and :attr:`run_status`
        attributes into stdout.
        """

        colors = {
            "W": 1,
            "R": 2,
            "C": 3
        }

        pc = {
            "running": 3,
            "complete": 3,
            "aborted": 4,
            "error": 4
        }

        curses.init_pair(1, curses.COLOR_WHITE, curses.COLOR_BLACK)
        curses.init_pair(2, curses.COLOR_BLUE, curses.COLOR_BLACK)
        curses.init_pair(3, curses.COLOR_GREEN, curses.COLOR_BLACK)
        curses.init_pair(4, curses.COLOR_MAGENTA, curses.COLOR_BLACK)

        # self.screen.erase()

        height, width = self.screen.getmaxyx()
        win = curses.newpad(height, 2000)

        # Add static header
        header = "Pipeline [{}] inspection at {}. Status: ".format(
            self.pipeline_tag, strftime("%Y-%m-%d %H:%M:%S", gmtime()))

        win.addstr(0, 0, header)
        win.addstr(0, len(header), self.run_status,
                   curses.color_pair(pc[self.run_status]))
        submission_str = "{0:23.23}  {1:23.23}  {2:23.23}  {3:23.23}".format(
            "Running: {}".format(
                sum([len(x["submitted"]) for x in self.processes.values()])
            ),
            "Failed: {}".format(
                sum([len(x["failed"]) for x in self.processes.values()])
            ),
            "Retrying: {}".format(
                sum([len(x["retry"]) for x in self.processes.values()])
            ),
            "Completed: {}".format(
                sum([len(x["finished"]) for x in self.processes.values()])
            )
        )

        win.addstr(
            1, 0, submission_str, curses.color_pair(1)
        )

        headers = ["", "Process", "Running", "Complete", "Error",
                   "Avg Time", "Max Mem", "Avg Read", "Avg Write"]
        header_str = "{0: ^1} " \
                     "{1: ^25}  " \
                     "{2: ^7} " \
                     "{3: ^7} " \
                     "{4: ^7} " \
                     "{5: ^10} " \
                     "{6: ^10} " \
                     "{7: ^10} " \
                     "{8: ^10} ".format(*headers)
        self.max_width = len(header_str)
        win.addstr(3, 0, header_str, curses.A_UNDERLINE | curses.A_REVERSE)

        # Get display size
        top = self.top_line
        bottom = self.screen_lines - 4 + self.top_line

        # Fetch process information
        for p, process in enumerate(
                list(self.processes.keys())[top:bottom]):

            if process not in self.process_stats:
                vals = ["-"] * 8
                txt_fmt = curses.A_NORMAL
            else:
                ref = self.process_stats[process]
                vals = [ref["completed"],
                        len(self.processes[process]["failed"]),
                        ref["realtime"],
                        ref["maxmem"], ref["avgread"],
                        ref["avgwrite"]]
                txt_fmt = curses.A_BOLD

            proc = self.processes[process]
            if proc["retry"]:
                completed = "{}({})".format(len(proc["submitted"]),
                                            len(proc["retry"]))
            else:
                completed = "{}".format(len(proc["submitted"]))

            win.addstr(
                4 + p, 0, "{0: ^1} "
                          "{1:25.25}  "
                          "{2: ^7} "
                          "{3: ^7} "
                          "{4: ^7} "
                          "{5: ^10} "
                          "{6: ^10} "
                          "{7: ^10} "
                          "{8: ^10} ".format(
                                proc["barrier"],
                                process,
                                completed,
                                *vals),
                curses.color_pair(colors[proc["barrier"]]) | txt_fmt)

        win.clrtoeol()
        win.refresh(0, self.padding, 0, 0, height-1, width-1)
def flush_overview ( self ) : colors = { "W" : 1 , "R" : 2 , "C" : 3 } pc = { "running" : 3 , "complete" : 3 , "aborted" : 4 , "error" : 4 } curses . init_pair ( 1 , curses . COLOR_WHITE , curses . COLOR_BLACK ) curses . init_pair ( 2 , curses . COLOR_BLUE , curses . COLOR_BLACK ) curses . init_pair ( 3 , curses . COLOR_GREEN , curses . COLOR_BLACK ) curses . init_pair ( 4 , curses . COLOR_MAGENTA , curses . COLOR_BLACK ) # self.screen.erase() height , width = self . screen . getmaxyx ( ) win = curses . newpad ( height , 2000 ) # Add static header header = "Pipeline [{}] inspection at {}. Status: " . format ( self . pipeline_tag , strftime ( "%Y-%m-%d %H:%M:%S" , gmtime ( ) ) ) win . addstr ( 0 , 0 , header ) win . addstr ( 0 , len ( header ) , self . run_status , curses . color_pair ( pc [ self . run_status ] ) ) submission_str = "{0:23.23}  {1:23.23}  {2:23.23}  {3:23.23}" . format ( "Running: {}" . format ( sum ( [ len ( x [ "submitted" ] ) for x in self . processes . values ( ) ] ) ) , "Failed: {}" . format ( sum ( [ len ( x [ "failed" ] ) for x in self . processes . values ( ) ] ) ) , "Retrying: {}" . format ( sum ( [ len ( x [ "retry" ] ) for x in self . processes . values ( ) ] ) ) , "Completed: {}" . format ( sum ( [ len ( x [ "finished" ] ) for x in self . processes . values ( ) ] ) ) ) win . addstr ( 1 , 0 , submission_str , curses . color_pair ( 1 ) ) headers = [ "" , "Process" , "Running" , "Complete" , "Error" , "Avg Time" , "Max Mem" , "Avg Read" , "Avg Write" ] header_str = "{0: ^1} " "{1: ^25}  " "{2: ^7} " "{3: ^7} " "{4: ^7} " "{5: ^10} " "{6: ^10} " "{7: ^10} " "{8: ^10} " . format ( * headers ) self . max_width = len ( header_str ) win . addstr ( 3 , 0 , header_str , curses . A_UNDERLINE | curses . A_REVERSE ) # Get display size top = self . top_line bottom = self . screen_lines - 4 + self . top_line # Fetch process information for p , process in enumerate ( list ( self . processes . keys ( ) ) [ top : bottom ] ) : if process not in self . process_stats : vals = [ "-" ] * 8 txt_fmt = curses . A_NORMAL else : ref = self . process_stats [ process ] vals = [ ref [ "completed" ] , len ( self . processes [ process ] [ "failed" ] ) , ref [ "realtime" ] , ref [ "maxmem" ] , ref [ "avgread" ] , ref [ "avgwrite" ] ] txt_fmt = curses . A_BOLD proc = self . processes [ process ] if proc [ "retry" ] : completed = "{}({})" . format ( len ( proc [ "submitted" ] ) , len ( proc [ "retry" ] ) ) else : completed = "{}" . format ( len ( proc [ "submitted" ] ) ) win . addstr ( 4 + p , 0 , "{0: ^1} " "{1:25.25}  " "{2: ^7} " "{3: ^7} " "{4: ^7} " "{5: ^10} " "{6: ^10} " "{7: ^10} " "{8: ^10} " . format ( proc [ "barrier" ] , process , completed , * vals ) , curses . color_pair ( colors [ proc [ "barrier" ] ] ) | txt_fmt ) win . clrtoeol ( ) win . refresh ( 0 , self . padding , 0 , 0 , height - 1 , width - 1 )
Displays the default overview of the pipeline execution from the
        :attr:`status_info`, :attr:`processes` and :attr:`run_status`
        attributes into stdout.
Displays the default overview of the pipeline execution from the : attr : status_info : attr : processes and : attr : run_status attributes into stdout .