def __get_real_pid(self):
        """
        Attempts to determine the true process ID by querying the
        /proc/<pid>/sched file.  This works on systems with a proc filesystem.
        Otherwise default to os default.
        """
        pid = None

        if os.path.exists("/proc/"):
            sched_file = "/proc/%d/sched" % os.getpid()

            if os.path.isfile(sched_file):
                try:
                    file = open(sched_file)
                    line = file.readline()
                    g = re.search(r'\((\d+),', line)
                    if len(g.groups()) == 1:
                        pid = int(g.groups()[0])
                except Exception:
                    logger.debug("parsing sched file failed", exc_info=True)
                    pass

        if pid is None:
            pid = os.getpid()

        return pid
def __get_real_pid ( self ) : pid = None if os . path . exists ( "/proc/" ) : sched_file = "/proc/%d/sched" % os . getpid ( ) if os . path . isfile ( sched_file ) : try : file = open ( sched_file ) line = file . readline ( ) g = re . search ( r'\((\d+),' , line ) if len ( g . groups ( ) ) == 1 : pid = int ( g . groups ( ) [ 0 ] ) except Exception : logger . debug ( "parsing sched file failed" , exc_info = True ) pass if pid is None : pid = os . getpid ( ) return pid
Attempts to determine the true process ID by querying the
        /proc/<pid>/sched file.  This works on systems with a proc filesystem.
        Otherwise default to os default.