def _checkDevices()

in benchmarking/run_remote.py [0:0]


    def _checkDevices(self, specified_devices, hashes=None):
        rows = self._listDevices(flag=False)
        specifiedDevices = set(specified_devices.split(","))
        specifiedHashes = None
        if hashes:
            hashes = hashes.split(",")
            devices = specified_devices.split(",")
            if len(hashes) != len(devices):
                raise Exception("You need to provide same number of hashes and devices")
            specifiedHashes = {}
            for i, hash in enumerate(hashes):
                specifiedHashes[hash] = devices[i]
        devices = {}
        devicesIn = True
        for row in rows:
            abbrs = row[-2].split(",") if row[-2] else []
            if row[-1] not in devices:
                devices[row[-1]] = {row[0]}.union(set(abbrs))
            else:
                devices[row[-1]].union({row[0]}.union(set(abbrs)))
        if specifiedHashes:
            for specifiedHash in specifiedHashes:
                if (
                    specifiedHash not in devices
                    or specifiedHashes[specifiedHash] not in devices[specifiedHash]
                ):
                    devicesIn = False
        else:
            allDevices = set()
            for v in devices.values():
                allDevices = allDevices.union(v)
            devicesIn = not specifiedDevices.difference(allDevices)
        if not devicesIn:
            errMessages = " ".join(
                [
                    "Devices",
                    specified_devices,
                    "is not available in the job_queue",
                    self.args.job_queue,
                ]
            )
            if hashes:
                errMessages = " ".join(
                    [
                        "Devices",
                        specified_devices,
                        "with hashes",
                        ",".join(hashes),
                        "is not available in the job_queue",
                        self.args.job_queue,
                    ]
                )
            raise Exception(errMessages)