- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I have a solution where I start lots of different docker containers (video2rabbitmq, rabbitmq, movidius object detector, identified object classification for good or bad object). All is started with docker-compose.
From the movidius object detector I am running more than one container to speed up the processing. In this process I am also managing device disconnection ( someone pull out the device from te usb) and reconnect.
But when one of the container want to reconnect I would need to know what device to use or what device is free.
So how can I find out from the device enumerate if one device is already used by an other container?
Thanx in advance
S&|
Link Copied
1 Reply
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I have solved it.
Currently I have 3 MOVIDIUS worker in separate docker container (docker-compose scale) and they i enumerate the available devices n parallel. If the same device (at the same time) was selected by more than one container then one will use it, while the other will get an error, then it start to iterate again while no device is found.
I am using the same to re-initiate if one of the device is disconnected while it was in use.
# Open the defined MOVIDIUS Neural Computing Stick
def openDevice(self):
# grab a list of all NCS devices plugged in to USB
while True:
print("[INFO] finding NCS devices...")
devices = mvnc.EnumerateDevices()
print("[INFO] NCS devices check done...")
# if no devices found, exit the script
if len(devices) == 0:
print("[INFO] No devices found. Please plug in a NCS")
time.sleep(1)
continue
opened = False
for i in range(0,len(devices)) :
try :
self.device = mvnc.Device(devices[i])
self.device.OpenDevice()
# open the CNN graph file defining the model
print("[INFO] loading the graph file( %s ) into memory..." % os.environ["GRAPH"])
with open(os.environ["GRAPH"], mode="rb") as f:
graph_in_memory = f.read()
# load the graph into the NCS
print("[INFO] allocating the graph on the NCS...")
self.graph = self.device.AllocateGraph(graph_in_memory)
opened = True
print("[INFO] Device ready")
break
except Exception as e:
continue
if opened :
break
else :
print("[ERROR] from device Opening. Will retry...")
time.sleep(1)
continue
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page