def show_status(self, **kwargs):
        """
        Report the status of the works and the status  of the different tasks on the specified stream.

        Args:
            stream: File-like object, Default: sys.stdout
            nids:  List of node identifiers. By defaults all nodes are shown
            wslice: Slice object used to select works.
            verbose: Verbosity level (default 0). > 0 to show only the works that are not finalized.
        """
        stream = kwargs.pop("stream", sys.stdout)
        nids = as_set(kwargs.pop("nids", None))
        wslice = kwargs.pop("wslice", None)
        verbose = kwargs.pop("verbose", 0)
        wlist = None
        if wslice is not None:
            # Convert range to list of work indices.
            wlist = list(range(wslice.start, wslice.step, wslice.stop))

        #has_colours = stream_has_colours(stream)
        has_colours = True
        red = "red" if has_colours else None

        for i, work in enumerate(self):
            if nids and work.node_id not in nids: continue
            print("", file=stream)
            cprint_map("Work #%d: %s, Finalized=%s" % (i, work, work.finalized), cmap={"True": "green"}, file=stream)
            if wlist is not None and i in wlist: continue
            if verbose == 0 and work.finalized:
                print("  Finalized works are not shown. Use verbose > 0 to force output.", file=stream)
                continue

            headers = ["Task", "Status", "Queue", "MPI|Omp|Gb",
                       "Warn|Com", "Class", "Sub|Rest|Corr", "Time",
                       "Node_ID"]
            table = []
            tot_num_errors = 0
            for task in work:
                if nids and task.node_id not in nids: continue
                task_name = os.path.basename(task.name)

                # FIXME: This should not be done here.
                # get_event_report should be called only in check_status
                # Parse the events in the main output.
                report = task.get_event_report()

                # Get time info (run-time or time in queue or None)
                stime = None
                timedelta = task.datetimes.get_runtime()
                if timedelta is not None:
                    stime = str(timedelta) + "R"
                else:
                    timedelta = task.datetimes.get_time_inqueue()
                    if timedelta is not None:
                        stime = str(timedelta) + "Q"

                events = "|".join(2*["NA"])
                if report is not None:
                    events = '{:>4}|{:>3}'.format(*map(str, (
                       report.num_warnings, report.num_comments)))

                para_info = '{:>4}|{:>3}|{:>3}'.format(*map(str, (
                   task.mpi_procs, task.omp_threads, "%.1f" % task.mem_per_proc.to("Gb"))))

                task_info = list(map(str, [task.__class__.__name__,
                                 (task.num_launches, task.num_restarts, task.num_corrections), stime, task.node_id]))

                qinfo = "None"
                if task.queue_id is not None:
                    qname = str(task.qname)
                    if not verbose:
                        qname = qname[:min(5, len(qname))]
                    qinfo = str(task.queue_id) + "@" + qname

                if task.status.is_critical:
                    tot_num_errors += 1
                    task_name = colored(task_name, red)

                if has_colours:
                    table.append([task_name, task.status.colored, qinfo,
                                  para_info, events] + task_info)
                else:
                    table.append([task_name, str(task.status), qinfo, events,
                                  para_info] + task_info)

            # Print table and write colorized line with the total number of errors.
            print(tabulate(table, headers=headers, tablefmt="grid"), file=stream)
            if tot_num_errors:
                cprint("Total number of errors: %d" % tot_num_errors, "red", file=stream)
            print("", file=stream)

        if self.all_ok:
            cprint("\nall_ok reached\n", "green", file=stream)
def show_status ( self , ** kwargs ) : stream = kwargs . pop ( "stream" , sys . stdout ) nids = as_set ( kwargs . pop ( "nids" , None ) ) wslice = kwargs . pop ( "wslice" , None ) verbose = kwargs . pop ( "verbose" , 0 ) wlist = None if wslice is not None : wlist = list ( range ( wslice . start , wslice . step , wslice . stop ) ) has_colours = True red = "red" if has_colours else None for i , work in enumerate ( self ) : if nids and work . node_id not in nids : continue print ( "" , file = stream ) cprint_map ( "Work #%d: %s, Finalized=%s" % ( i , work , work . finalized ) , cmap = { "True" : "green" } , file = stream ) if wlist is not None and i in wlist : continue if verbose == 0 and work . finalized : print ( "  Finalized works are not shown. Use verbose > 0 to force output." , file = stream ) continue headers = [ "Task" , "Status" , "Queue" , "MPI|Omp|Gb" , "Warn|Com" , "Class" , "Sub|Rest|Corr" , "Time" , "Node_ID" ] table = [ ] tot_num_errors = 0 for task in work : if nids and task . node_id not in nids : continue task_name = os . path . basename ( task . name ) report = task . get_event_report ( ) stime = None timedelta = task . datetimes . get_runtime ( ) if timedelta is not None : stime = str ( timedelta ) + "R" else : timedelta = task . datetimes . get_time_inqueue ( ) if timedelta is not None : stime = str ( timedelta ) + "Q" events = "|" . join ( 2 * [ "NA" ] ) if report is not None : events = '{:>4}|{:>3}' . format ( * map ( str , ( report . num_warnings , report . num_comments ) ) ) para_info = '{:>4}|{:>3}|{:>3}' . format ( * map ( str , ( task . mpi_procs , task . omp_threads , "%.1f" % task . mem_per_proc . to ( "Gb" ) ) ) ) task_info = list ( map ( str , [ task . __class__ . __name__ , ( task . num_launches , task . num_restarts , task . num_corrections ) , stime , task . node_id ] ) ) qinfo = "None" if task . queue_id is not None : qname = str ( task . qname ) if not verbose : qname = qname [ : min ( 5 , len ( qname ) ) ] qinfo = str ( task . queue_id ) + "@" + qname if task . status . is_critical : tot_num_errors += 1 task_name = colored ( task_name , red ) if has_colours : table . append ( [ task_name , task . status . colored , qinfo , para_info , events ] + task_info ) else : table . append ( [ task_name , str ( task . status ) , qinfo , events , para_info ] + task_info ) print ( tabulate ( table , headers = headers , tablefmt = "grid" ) , file = stream ) if tot_num_errors : cprint ( "Total number of errors: %d" % tot_num_errors , "red" , file = stream ) print ( "" , file = stream ) if self . all_ok : cprint ( "\nall_ok reached\n" , "green" , file = stream )
Report the status of the works and the status  of the different tasks on the specified stream.

        Args:
            stream: File-like object, Default: sys.stdout
            nids:  List of node identifiers. By defaults all nodes are shown
            wslice: Slice object used to select works.
            verbose: Verbosity level (default 0). > 0 to show only the works that are not finalized.