def check_stuck()

in dcrpm/yum.py [0:0]


    def check_stuck(self, dry_run=False):
        # type: (bool) -> bool
        try:
            pid, mtime = pidutil.pidfile_info(YUM_PID_PATH)
        # Fine if there's no pidfile, means nothing is using yum.
        except IOError:
            self.logger.info("No yum pid found. Assuming yum not stuck.")
            return True
        except ValueError:
            self.logger.info("Invalid pid value")
            return False
        except Exception:
            self.logger.error("Cannot read %s", YUM_PID_PATH)
            return False

        # Check whether yum.pid mtime is new enough.
        age = int(time.time()) - mtime
        if age < MIN_YUM_AGE:
            self.logger.info("Found yum.pid, but is only %ds old", age)
            return True

        # Check what command corresponds to yum.pid.
        proc = pidutil.process(pid)
        if not proc:
            self.status_logger.warning("Failed to get command name")
            return False
        name = proc.name()
        if name != self.yum:
            msg = "Found wrong command name [{}], expecting {}".format(name, self.yum)
            self.status_logger.warning(msg)
            self.logger.error(msg)
            return False

        self.logger.info("Got: pid=%d, mtime=%d, cmdname=%s", pid, mtime, name)
        if dry_run:
            self.logger.info("Dry-run mode; would have killed pid %d", pid)
            return True

        self.logger.info("Killing pid %d", pid)
        if not pidutil.send_signal(proc, signal.SIGKILL, timeout=KILL_TIMEOUT):
            self.status_logger.warning("kill failed")
            return False

        self.status_logger.warning(RepairAction.STUCK_YUM)
        return True