browser, worker: feed experiments dummy devices, closes #454

* just returning `None` as dummy device (like ExamineDeviceMgr)
is not explicit enough, certainly hard to debug
* introducing a special flag for the `build` action does not
seem the right place
This commit is contained in:
Robert Jördens 2016-07-08 01:23:28 +02:00
parent b7cca38f72
commit 2a5a1f320f
2 changed files with 8 additions and 2 deletions

View File

@ -376,8 +376,8 @@ class ExperimentsArea(QtWidgets.QMdiArea):
self._ddb = LocalDatasetDB(datasets_sub) self._ddb = LocalDatasetDB(datasets_sub)
self.worker_handlers = { self.worker_handlers = {
"get_device_db": lambda: None, "get_device_db": lambda: {},
"get_device": lambda k: None, "get_device": lambda k: {"type": "dummy"},
"get_dataset": self._ddb.get, "get_dataset": self._ddb.get,
"update_dataset": self._ddb.update, "update_dataset": self._ddb.update,
} }

View File

@ -85,6 +85,10 @@ class RIDCounter:
return r return r
class DummyDevice:
pass
def _create_device(desc, device_mgr): def _create_device(desc, device_mgr):
ty = desc["type"] ty = desc["type"]
if ty == "local": if ty == "local":
@ -109,6 +113,8 @@ def _create_device(desc, device_mgr):
else: else:
cls = Client cls = Client
return cls(controller["host"], controller["port"], desc["target_name"]) return cls(controller["host"], controller["port"], desc["target_name"])
elif ty == "dummy":
return DummyDevice()
else: else:
raise ValueError("Unsupported type in device DB: " + ty) raise ValueError("Unsupported type in device DB: " + ty)