Esempio n. 1
0
    def __init__(self,
                 flowcell: FlowCellPosition,
                 server="localhost",
                 logger=None):
        self.flowcell = flowcell
        port = flowcell.rpc_ports.insecure
        self.server = server
        address = get_address(server, port)
        self.channel = grpc.insecure_channel(address)

        self.logger = logger or logging.getLogger(__name__)

        self._protocol_stub = protocol_grpc.ProtocolServiceStub(self.channel)
        self._data_stub = data_rpc.DataServiceStub(self.channel)
Esempio n. 2
0
    def __init__(self, channel, start_request: StartProtocolRequest):
        """You don't have to worry about creating these yourself. Use the `make_experiment(...)` method of `Flowcell`.

        Parameters
        ----------
        protocol_stub : [type]
            [description]
        start_request : StartProtocolRequest
            [description]
        """
        self.run_id = None
        self.channel = channel
        self._protocol_stub = protocol_rpc.ProtocolServiceStub(channel)
        self._start_request = start_request
 def get_protocol_running_status(self, host, device):
     channel = grpc.insecure_channel('%s:%s' %
                                     (host, device.ports.insecure_grpc))
     stub = protocol_pb2_grpc.ProtocolServiceStub(channel)
     request = protocol_pb2.GetRunInfoRequest()
     try:
         info = stub.get_current_protocol_run(request)
         if info.run_id:
             return True
         else:
             return False
     except _InactiveRpcError as e:
         if not e.details() == 'No protocol running':
             raise e
         return False
Esempio n. 4
0
# See 'list_devices.py' to find out more about available devices.
device = list_devices_response.active[0]
print("Using device %s using gRPC port %s" %
      (device.name, device.ports.insecure_grpc))

#-------------------------------------------------------------------------------

#-------------------------------------------------------------------------------
# Connect to the running MinKNOW instance:
#
# We can connect to a running MinKNOW instance on the local
# computer (using port from above)
#
channel = grpc.insecure_channel('localhost:%s' % device.ports.insecure_grpc)
stub = protocol_grpc.ProtocolServiceStub(channel)
#-------------------------------------------------------------------------------

#-------------------------------------------------------------------------------
# Find the protocols available on the running MinKNOW instance:
#
print("Listing protocols:")

# Construct a list message to send to MinKNOW
list_request = protocol.ListProtocolsRequest()
# Send the message to MinKNOW and wait for a response
available_protocols = stub.list_protocols(list_request)
print("Found protocols: %s" % available_protocols)
#-------------------------------------------------------------------------------

#-------------------------------------------------------------------------------
Esempio n. 5
0
 def protocols(self, force_reload=False):
     protocol_stub = protocol_grpc.ProtocolServiceStub(self.channel)
     protocols = protocol_stub.list_protocols(
         protocol.ListProtocolsRequest(force_reload=force_reload))
     return protocols