Ejemplo n.º 1
0
 def _raw_nvr(self):
     cmd = ["rpm", "-q", self.name]
     nvr = process.pipe(cmd).strip().split("\n")
     self.logger.debug("Found build: %s" % nvr)
     if len(nvr) != 1:
         raise RuntimeError("Failed to retrieve nvr for %s: %s" %
                            (self.name, nvr))
     return nvr[0]
Ejemplo n.º 2
0
def journal(unit=None, this_boot=True):
    """Convenience function to access the journal
    """
    cmd = ["journalctl"]
    if unit:
        cmd += ["--unit", unit]
    if this_boot:
        cmd += ["--this-boot"]
    return process.pipe(cmd)
Ejemplo n.º 3
0
    def get_hostkey(self, variant="rsa"):
        fn_hostkey = "/etc/ssh/ssh_host_%s_key.pub" % variant
        if not os.path.exists(fn_hostkey):
            raise Exception("SSH hostkey does not yet exist.")

        hostkey = File(fn_hostkey).read()

        hostkey_fp_cmd = "ssh-keygen -l -f '%s'" % fn_hostkey
        fingerprint = process.pipe(hostkey_fp_cmd).strip().split(" ")[1]
        return (fingerprint, hostkey)
Ejemplo n.º 4
0
    def get_hostkey(self, variant="rsa"):
        fn_hostkey = "/etc/ssh/ssh_host_%s_key.pub" % variant
        if not os.path.exists(fn_hostkey):
            raise Exception("SSH hostkey does not yet exist.")

        hostkey = File(fn_hostkey).read()

        hostkey_fp_cmd = "ssh-keygen -l -f '%s'" % fn_hostkey
        fingerprint = process.pipe(hostkey_fp_cmd).strip().split(" ")[1]
        return (fingerprint, hostkey)
Ejemplo n.º 5
0
def cpu_details():
    """Return details for the CPU of this machine
    """
    fields = [
        "Model name", "Architecture", "CPU MHz", "Virtualization", "CPU(s)",
        "Socket(s)", "Core(s) per socket", "Thread(s) per core"
    ]

    data = process.pipe(["lscpu"])
    cpu = _parse_lscpu(data)

    # Fallback for some values
    cpuinfo = _parse_lscpu(File("/proc/cpuinfo").read())
    cpu["Model name"] = \
        cpu.get("Model name", "") or cpuinfo.get("model name", "")

    cpu_details = ("%s: %s" % (f, cpu.get(f, "(Unknown)")) for f in fields)

    return "\n".join(cpu_details)
Ejemplo n.º 6
0
import cv2  
import numpy
import process
import os
os.remove('AUV_owen\original_data\original_data.txt')
avi_file_path1 = r'D:\github\Underwater-robot-competition\AUV_owen\dataset\recut\20210115_161634_Trim.mp4'
avi_file_path2 = r'D:\github\Underwater-robot-competition\AUV_owen\dataset\recut\20210115_162231_Trim.mp4'
cap = cv2.VideoCapture(avi_file_path1)
cap.set(cv2.CAP_PROP_FPS,20)
fps = cap.get(5)
frame_count = cap.get(7)
FIFO = process.pipe()
frame_num = 0
while(1):
    ret, frame = cap.read()
    frame = cv2.resize(frame,dsize=None,fx=0.5,fy=0.5)
    Processed = process.imgprocess_detect_adsorbate(frame)
    frame = Processed.processed
    data = Processed.detect_data #检测数据
    #数据读入管道
    FIFO.pipe_life.append(data[0]) 
    FIFO.pipe_type.append(data[1])
    FIFO.pipe_x.append(data[2])
    FIFO.pipe_y.append(data[3])
    FIFO.pipe_area.append(data[4])
    FIFO.reboot_judge() #限制长度

    #管道中判定

    ob_type = FIFO.lifetime_judge()  
    if ob_type == 1: